[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / jni / bindings.c
1 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
4 #define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
5 #include <jni.h>
6 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
7 #define int64_t jlong
8 #include "org_ldk_impl_bindings.h"
9 #include <lightning.h>
10 #include <string.h>
11 #include <stdatomic.h>
12 #include <stdlib.h>
13
14 #define LIKELY(v) __builtin_expect(!!(v), 1)
15 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
16
17 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
18 #define MALLOC(a, _) malloc(a)
19 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
20 #define CHECK_ACCESS(p)
21 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
22 #define DO_ASSERT(a) (void)(a)
23 #define CHECK(a)
24
25 static jmethodID ordinal_meth = NULL;
26 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) {
27         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
28         CHECK(ordinal_meth != NULL);
29 }
30
31 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
32 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
35
36 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
37 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
38 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
39
40 typedef jlongArray int64_tArray;
41 typedef jbyteArray int8_tArray;
42 typedef jshortArray int16_tArray;
43
44 static inline jstring str_ref_to_java(JNIEnv *env, const unsigned char* chars, size_t len) {
45         // Java uses "Modified UTF-8" rather than UTF-8. This requires special
46         // handling for codepoints above 0xFFFF, which get converted from four
47         // bytes to six. We don't know upfront how many codepoints in the string
48         // are above 0xFFFF, so we just allocate an extra 33% up front and waste a
49         // bit of space.
50         unsigned char* java_chars = MALLOC(len * 3 / 2 + 1, "str conv buf");
51         unsigned char* next_java_char = java_chars;
52         const unsigned char* next_in_char = chars;
53         const unsigned char* end = chars + len;
54         #define COPY_CHAR_TO_JAVA do { *next_java_char = *next_in_char; next_java_char++; next_in_char++; } while (0)
55
56         while (next_in_char < end) {
57                 if (!*next_in_char) break;
58                 if (!(*next_in_char & 0b10000000)) {
59                         COPY_CHAR_TO_JAVA;
60                 } else if ((*next_in_char & 0b11100000) == 0b11000000) {
61                         if (next_in_char + 2 > end) { CHECK(false); break; } // bad string
62                         COPY_CHAR_TO_JAVA;
63                         COPY_CHAR_TO_JAVA;
64                 } else if ((*next_in_char & 0b11110000) == 0b11100000) {
65                         if (next_in_char + 3 > end) { CHECK(false); break; } // bad string
66                         COPY_CHAR_TO_JAVA;
67                         COPY_CHAR_TO_JAVA;
68                         COPY_CHAR_TO_JAVA;
69                 } else if ((*next_in_char & 0b11111000) == 0b11110000) {
70                         if (next_in_char + 4 > end) { CHECK(false); break; } // bad string
71                         uint32_t codepoint = 0;
72                         codepoint |= (((uint32_t)*(next_in_char    )) & 0b00000111) << 18;
73                         codepoint |= (((uint32_t)*(next_in_char + 1)) & 0b00111111) << 12;
74                         codepoint |= (((uint32_t)*(next_in_char + 2)) & 0b00111111) << 6;
75                         codepoint |= (((uint32_t)*(next_in_char + 3)) & 0b00111111) << 0;
76                         codepoint -= 0x10000;
77                         *next_java_char = 0b11101101;
78                         next_java_char++;
79                         *next_java_char = 0b10100000 | ((codepoint >> 16) & 0b00001111);
80                         next_java_char++;
81                         *next_java_char = 0b10000000 | ((codepoint >> 10) & 0b00111111);
82                         next_java_char++;
83                         *next_java_char = 0b11101101;
84                         next_java_char++;
85                         *next_java_char = 0b10110000 | ((codepoint >>  6) & 0b00001111);
86                         next_java_char++;
87                         *next_java_char = 0b10000000 | ((codepoint >>  0) & 0b00111111);
88                         next_java_char++;
89                         next_in_char += 4;
90                 } else {
91                         // Bad string
92                         CHECK(false);
93                         break;
94                 }
95         }
96         *next_java_char = 0;
97         jstring ret = (*env)->NewStringUTF(env, java_chars);
98         FREE(java_chars);
99         return ret;
100 }
101 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
102         uint64_t str_len = (*env)->GetStringUTFLength(env, str);
103         // Java uses "Modified UTF-8" rather than UTF-8. This requires special
104         // handling for codepoints above 0xFFFF, which we implement below.
105         unsigned char* newchars = MALLOC(str_len, "String chars");
106         unsigned char* next_newchar = newchars;
107         uint64_t utf8_len = 0;
108
109         const unsigned char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
110         const unsigned char* next_char = jchars;
111         const unsigned char* end = jchars + str_len;
112
113         #define COPY_CHAR_FROM_JAVA do { *next_newchar = *next_char; next_newchar++; next_char++; utf8_len++; } while (0)
114
115         while (next_char < end) {
116                 if (!(*next_char & 0b10000000)) {
117                         CHECK(*next_char != 0); // Bad Modified UTF-8 string, but we'll just cut here
118                         COPY_CHAR_FROM_JAVA;
119                 } else if ((*next_char & 0b11100000) == 0b11000000) {
120                         if (next_char + 2 > end) { CHECK(false); break; } // bad string
121                         uint16_t codepoint = 0;
122                         codepoint |= (((uint16_t)(*next_char & 0x1f)) << 6);
123                         codepoint |= *(next_char + 1) & 0x3f;
124                         if (codepoint == 0) {
125                                 // We should really never get null codepoints, but java allows them.
126                                 // Just skip it.
127                                 next_char += 2;
128                         } else {
129                                 COPY_CHAR_FROM_JAVA;
130                                 COPY_CHAR_FROM_JAVA;
131                         }
132                 } else if ((*next_char & 0b11110000) == 0b11100000) {
133                         if (next_char + 3 > end) { CHECK(false); break; } // bad string
134                         if (*next_char == 0b11101101 && (*(next_char + 1) & 0b11110000) == 0b10100000) {
135                                 // Surrogate code unit shoul indicate we have a codepoint above
136                                 // 0xFFFF, which is where Modified UTF-8 and UTF-8 diverge.
137                                 if (next_char + 6 > end) { CHECK(false); break; } // bad string
138                                 CHECK(*(next_char + 3) == 0b11101101);
139                                 CHECK((*(next_char + 4) & 0b11110000) == 0b10110000);
140                                 // Calculate the codepoint per https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/types.html#wp16542
141                                 uint32_t codepoint = 0x10000;
142                                 codepoint += ((((uint32_t)*(next_char + 1)) & 0x0f) << 16);
143                                 codepoint += ((((uint32_t)*(next_char + 2)) & 0x3f) << 10);
144                                 codepoint += ((((uint32_t)*(next_char + 4)) & 0x0f) <<  6);
145                                 codepoint +=  (((uint32_t)*(next_char + 5)) & 0x3f);
146                                 *next_newchar = 0b11110000 | ((codepoint >> 18) &    0b111);
147                                 next_newchar++;
148                                 *next_newchar = 0b10000000 | ((codepoint >> 12) & 0b111111);
149                                 next_newchar++;
150                                 *next_newchar = 0b10000000 | ((codepoint >>  6) & 0b111111);
151                                 next_newchar++;
152                                 *next_newchar = 0b10000000 | ( codepoint        & 0b111111);
153                                 next_newchar++;
154                                 next_char += 6;
155                                 utf8_len += 4;
156                         } else {
157                                 COPY_CHAR_FROM_JAVA;
158                                 COPY_CHAR_FROM_JAVA;
159                                 COPY_CHAR_FROM_JAVA;
160                         }
161                 } else {
162                         // Bad string
163                         CHECK(false);
164                         break;
165                 }
166         }
167         (*env)->ReleaseStringUTFChars(env, str, jchars);
168         LDKStr res = {
169                 .chars = newchars,
170                 .len = utf8_len,
171                 .chars_is_owned = true
172         };
173         return res;
174 }
175
176 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
177         return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
178 }
179 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
180         return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
181 }
182 #include "version.c"
183 static jclass arr_of_B_clz = NULL;
184 static jclass String_clz = NULL;
185 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
186         arr_of_B_clz = (*env)->FindClass(env, "[B");
187         CHECK(arr_of_B_clz != NULL);
188         arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
189         String_clz = (*env)->FindClass(env, "java/lang/String");
190         CHECK(String_clz != NULL);
191         String_clz = (*env)->NewGlobalRef(env, String_clz);
192 }
193 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
194
195 static inline void* untag_ptr(uint64_t ptr) {
196         if (ptr < 4096) return (void*)ptr;
197         if (sizeof(void*) == 4) {
198                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
199                 return (void*)(uintptr_t)ptr;
200         } else {
201                 // For 64-bit systems, assume the top byte is used for tagging, then
202                 // use bit 9 ^ bit 10.
203                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
204                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
205 #ifdef LDK_DEBUG_BUILD
206                 // On debug builds we also use the 11th bit as a debug flag
207                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
208                 CHECK(tenth_bit != eleventh_bit);
209                 p ^= 1ULL << 53;
210 #endif
211                 return (void*)p;
212         }
213 }
214 static inline bool ptr_is_owned(uint64_t ptr) {
215         if(ptr < 4096) return true;
216         if (sizeof(void*) == 4) {
217                 return ptr & (1ULL << 32);
218         } else {
219                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
220                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
221 #ifdef LDK_DEBUG_BUILD
222                 // On debug builds we also use the 11th bit as a debug flag
223                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
224                 CHECK(tenth_bit != eleventh_bit);
225 #endif
226                 return (ninth_bit ^ tenth_bit) ? true : false;
227         }
228 }
229 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
230         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
231         if (sizeof(void*) == 4) {
232                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
233         } else {
234                 CHECK(sizeof(uintptr_t) == 8);
235                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
236                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
237 #ifdef LDK_DEBUG_BUILD
238                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
239                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
240                 CHECK(ninth_bit == tenth_bit);
241                 CHECK(ninth_bit == eleventh_bit);
242                 t ^= 1ULL << 53;
243 #endif
244                 CHECK(ptr_is_owned(t) == is_owned);
245                 CHECK(untag_ptr(t) == ptr);
246                 return t;
247         }
248 }
249
250 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_java(JNIEnv *env, jclass clz) {
251         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
252         if (UNLIKELY((*env)->ExceptionCheck(env))) {
253                 (*env)->ExceptionDescribe(env);
254                 (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust threw an exception.");
255         }
256         switch (ord) {
257                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
258                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
259                 case 2: return LDKBolt11SemanticError_NoDescription;
260                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
261                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
262                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
263                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
264                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
265                 case 8: return LDKBolt11SemanticError_InvalidSignature;
266                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
267         }
268         (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust returned an invalid value.");
269         abort(); // Unreachable, but will let the compiler know we don't return here
270 }
271 static jclass Bolt11SemanticError_class = NULL;
272 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = NULL;
273 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = NULL;
274 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = NULL;
275 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = NULL;
276 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = NULL;
277 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = NULL;
278 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = NULL;
279 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = NULL;
280 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = NULL;
281 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = NULL;
282 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt11SemanticError_init (JNIEnv *env, jclass clz) {
283         Bolt11SemanticError_class = (*env)->NewGlobalRef(env, clz);
284         CHECK(Bolt11SemanticError_class != NULL);
285         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentHash", "Lorg/ldk/enums/Bolt11SemanticError;");
286         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash != NULL);
287         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/Bolt11SemanticError;");
288         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes != NULL);
289         Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoDescription", "Lorg/ldk/enums/Bolt11SemanticError;");
290         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoDescription != NULL);
291         Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultipleDescriptions", "Lorg/ldk/enums/Bolt11SemanticError;");
292         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions != NULL);
293         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentSecret", "Lorg/ldk/enums/Bolt11SemanticError;");
294         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret != NULL);
295         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/Bolt11SemanticError;");
296         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets != NULL);
297         Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidFeatures", "Lorg/ldk/enums/Bolt11SemanticError;");
298         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures != NULL);
299         Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidRecoveryId", "Lorg/ldk/enums/Bolt11SemanticError;");
300         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId != NULL);
301         Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidSignature", "Lorg/ldk/enums/Bolt11SemanticError;");
302         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature != NULL);
303         Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_ImpreciseAmount", "Lorg/ldk/enums/Bolt11SemanticError;");
304         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount != NULL);
305 }
306 static inline jclass LDKBolt11SemanticError_to_java(JNIEnv *env, LDKBolt11SemanticError val) {
307         switch (val) {
308                 case LDKBolt11SemanticError_NoPaymentHash:
309                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash);
310                 case LDKBolt11SemanticError_MultiplePaymentHashes:
311                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes);
312                 case LDKBolt11SemanticError_NoDescription:
313                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoDescription);
314                 case LDKBolt11SemanticError_MultipleDescriptions:
315                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions);
316                 case LDKBolt11SemanticError_NoPaymentSecret:
317                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret);
318                 case LDKBolt11SemanticError_MultiplePaymentSecrets:
319                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets);
320                 case LDKBolt11SemanticError_InvalidFeatures:
321                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures);
322                 case LDKBolt11SemanticError_InvalidRecoveryId:
323                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId);
324                 case LDKBolt11SemanticError_InvalidSignature:
325                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature);
326                 case LDKBolt11SemanticError_ImpreciseAmount:
327                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount);
328                 default: abort();
329         }
330 }
331
332 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *env, jclass clz) {
333         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
334         if (UNLIKELY((*env)->ExceptionCheck(env))) {
335                 (*env)->ExceptionDescribe(env);
336                 (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust threw an exception.");
337         }
338         switch (ord) {
339                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
340                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
341                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
342                 case 3: return LDKBolt12SemanticError_MissingAmount;
343                 case 4: return LDKBolt12SemanticError_InvalidAmount;
344                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
345                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
346                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
347                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
348                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
349                 case 10: return LDKBolt12SemanticError_MissingDescription;
350                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
351                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
352                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
353                 case 14: return LDKBolt12SemanticError_MissingQuantity;
354                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
355                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
356                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
357                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
358                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
359                 case 20: return LDKBolt12SemanticError_MissingPayerId;
360                 case 21: return LDKBolt12SemanticError_MissingPaths;
361                 case 22: return LDKBolt12SemanticError_InvalidPayInfo;
362                 case 23: return LDKBolt12SemanticError_MissingCreationTime;
363                 case 24: return LDKBolt12SemanticError_MissingPaymentHash;
364                 case 25: return LDKBolt12SemanticError_MissingSignature;
365         }
366         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
367         abort(); // Unreachable, but will let the compiler know we don't return here
368 }
369 static jclass Bolt12SemanticError_class = NULL;
370 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
371 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
372 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
373 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
374 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
375 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
376 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
377 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
378 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
379 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
380 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
381 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
382 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
383 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
384 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
385 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
386 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
387 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
388 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
389 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
390 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
391 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
392 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
393 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
394 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
395 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
396 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
397         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
398         CHECK(Bolt12SemanticError_class != NULL);
399         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
400         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
401         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
402         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
403         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
404         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
405         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
406         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
407         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
408         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
409         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
410         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
411         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
412         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
413         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
414         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
415         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
416         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
417         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
418         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
419         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
420         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
421         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
422         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
423         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
424         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
425         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
426         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
427         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
428         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
429         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
430         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
431         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
432         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
433         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
434         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
435         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
436         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
437         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
438         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
439         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
440         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
441         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
442         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
443         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
444         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
445         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
446         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
447         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
448         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
449         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
450         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
451 }
452 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
453         switch (val) {
454                 case LDKBolt12SemanticError_AlreadyExpired:
455                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
456                 case LDKBolt12SemanticError_UnsupportedChain:
457                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
458                 case LDKBolt12SemanticError_UnexpectedChain:
459                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
460                 case LDKBolt12SemanticError_MissingAmount:
461                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
462                 case LDKBolt12SemanticError_InvalidAmount:
463                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
464                 case LDKBolt12SemanticError_InsufficientAmount:
465                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
466                 case LDKBolt12SemanticError_UnexpectedAmount:
467                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
468                 case LDKBolt12SemanticError_UnsupportedCurrency:
469                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
470                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
471                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
472                 case LDKBolt12SemanticError_UnexpectedFeatures:
473                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
474                 case LDKBolt12SemanticError_MissingDescription:
475                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
476                 case LDKBolt12SemanticError_MissingSigningPubkey:
477                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
478                 case LDKBolt12SemanticError_InvalidSigningPubkey:
479                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
480                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
481                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
482                 case LDKBolt12SemanticError_MissingQuantity:
483                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
484                 case LDKBolt12SemanticError_InvalidQuantity:
485                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
486                 case LDKBolt12SemanticError_UnexpectedQuantity:
487                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
488                 case LDKBolt12SemanticError_InvalidMetadata:
489                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
490                 case LDKBolt12SemanticError_UnexpectedMetadata:
491                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
492                 case LDKBolt12SemanticError_MissingPayerMetadata:
493                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
494                 case LDKBolt12SemanticError_MissingPayerId:
495                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
496                 case LDKBolt12SemanticError_MissingPaths:
497                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
498                 case LDKBolt12SemanticError_InvalidPayInfo:
499                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
500                 case LDKBolt12SemanticError_MissingCreationTime:
501                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
502                 case LDKBolt12SemanticError_MissingPaymentHash:
503                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
504                 case LDKBolt12SemanticError_MissingSignature:
505                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
506                 default: abort();
507         }
508 }
509
510 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
511         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
512         if (UNLIKELY((*env)->ExceptionCheck(env))) {
513                 (*env)->ExceptionDescribe(env);
514                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
515         }
516         switch (ord) {
517                 case 0: return LDKCOption_NoneZ_Some;
518                 case 1: return LDKCOption_NoneZ_None;
519         }
520         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
521         abort(); // Unreachable, but will let the compiler know we don't return here
522 }
523 static jclass COption_NoneZ_class = NULL;
524 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
525 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
526 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
527         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
528         CHECK(COption_NoneZ_class != NULL);
529         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
530         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
531         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
532         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
533 }
534 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
535         switch (val) {
536                 case LDKCOption_NoneZ_Some:
537                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
538                 case LDKCOption_NoneZ_None:
539                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
540                 default: abort();
541         }
542 }
543
544 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
545         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
546         if (UNLIKELY((*env)->ExceptionCheck(env))) {
547                 (*env)->ExceptionDescribe(env);
548                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
549         }
550         switch (ord) {
551                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
552                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
553                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
554         }
555         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
556         abort(); // Unreachable, but will let the compiler know we don't return here
557 }
558 static jclass ChannelMonitorUpdateStatus_class = NULL;
559 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
560 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
561 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = NULL;
562 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
563         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
564         CHECK(ChannelMonitorUpdateStatus_class != NULL);
565         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
566         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
567         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
568         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
569         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_UnrecoverableError", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
570         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError != NULL);
571 }
572 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
573         switch (val) {
574                 case LDKChannelMonitorUpdateStatus_Completed:
575                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
576                 case LDKChannelMonitorUpdateStatus_InProgress:
577                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
578                 case LDKChannelMonitorUpdateStatus_UnrecoverableError:
579                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError);
580                 default: abort();
581         }
582 }
583
584 static inline LDKChannelShutdownState LDKChannelShutdownState_from_java(JNIEnv *env, jclass clz) {
585         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
586         if (UNLIKELY((*env)->ExceptionCheck(env))) {
587                 (*env)->ExceptionDescribe(env);
588                 (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust threw an exception.");
589         }
590         switch (ord) {
591                 case 0: return LDKChannelShutdownState_NotShuttingDown;
592                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
593                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
594                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
595                 case 4: return LDKChannelShutdownState_ShutdownComplete;
596         }
597         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
598         abort(); // Unreachable, but will let the compiler know we don't return here
599 }
600 static jclass ChannelShutdownState_class = NULL;
601 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
602 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
603 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
604 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
605 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
606 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
607         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
608         CHECK(ChannelShutdownState_class != NULL);
609         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
610         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
611         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
612         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
613         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
614         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
615         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
616         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
617         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
618         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
619 }
620 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
621         switch (val) {
622                 case LDKChannelShutdownState_NotShuttingDown:
623                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
624                 case LDKChannelShutdownState_ShutdownInitiated:
625                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
626                 case LDKChannelShutdownState_ResolvingHTLCs:
627                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
628                 case LDKChannelShutdownState_NegotiatingClosingFee:
629                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
630                 case LDKChannelShutdownState_ShutdownComplete:
631                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
632                 default: abort();
633         }
634 }
635
636 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
637         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
638         if (UNLIKELY((*env)->ExceptionCheck(env))) {
639                 (*env)->ExceptionDescribe(env);
640                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
641         }
642         switch (ord) {
643                 case 0: return LDKConfirmationTarget_MempoolMinimum;
644                 case 1: return LDKConfirmationTarget_Background;
645                 case 2: return LDKConfirmationTarget_Normal;
646                 case 3: return LDKConfirmationTarget_HighPriority;
647         }
648         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
649         abort(); // Unreachable, but will let the compiler know we don't return here
650 }
651 static jclass ConfirmationTarget_class = NULL;
652 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = NULL;
653 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
654 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
655 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
656 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
657         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
658         CHECK(ConfirmationTarget_class != NULL);
659         ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MempoolMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
660         CHECK(ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum != NULL);
661         ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
662         CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
663         ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
664         CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
665         ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
666         CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
667 }
668 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
669         switch (val) {
670                 case LDKConfirmationTarget_MempoolMinimum:
671                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum);
672                 case LDKConfirmationTarget_Background:
673                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
674                 case LDKConfirmationTarget_Normal:
675                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
676                 case LDKConfirmationTarget_HighPriority:
677                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
678                 default: abort();
679         }
680 }
681
682 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
683         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
684         if (UNLIKELY((*env)->ExceptionCheck(env))) {
685                 (*env)->ExceptionDescribe(env);
686                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
687         }
688         switch (ord) {
689                 case 0: return LDKCreationError_DescriptionTooLong;
690                 case 1: return LDKCreationError_RouteTooLong;
691                 case 2: return LDKCreationError_TimestampOutOfBounds;
692                 case 3: return LDKCreationError_InvalidAmount;
693                 case 4: return LDKCreationError_MissingRouteHints;
694                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
695         }
696         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
697         abort(); // Unreachable, but will let the compiler know we don't return here
698 }
699 static jclass CreationError_class = NULL;
700 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
701 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
702 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
703 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
704 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
705 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
706 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
707         CreationError_class = (*env)->NewGlobalRef(env, clz);
708         CHECK(CreationError_class != NULL);
709         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
710         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
711         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
712         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
713         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
714         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
715         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
716         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
717         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
718         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
719         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
720         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
721 }
722 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
723         switch (val) {
724                 case LDKCreationError_DescriptionTooLong:
725                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
726                 case LDKCreationError_RouteTooLong:
727                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
728                 case LDKCreationError_TimestampOutOfBounds:
729                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
730                 case LDKCreationError_InvalidAmount:
731                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
732                 case LDKCreationError_MissingRouteHints:
733                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
734                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
735                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
736                 default: abort();
737         }
738 }
739
740 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
741         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
742         if (UNLIKELY((*env)->ExceptionCheck(env))) {
743                 (*env)->ExceptionDescribe(env);
744                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
745         }
746         switch (ord) {
747                 case 0: return LDKCurrency_Bitcoin;
748                 case 1: return LDKCurrency_BitcoinTestnet;
749                 case 2: return LDKCurrency_Regtest;
750                 case 3: return LDKCurrency_Simnet;
751                 case 4: return LDKCurrency_Signet;
752         }
753         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
754         abort(); // Unreachable, but will let the compiler know we don't return here
755 }
756 static jclass Currency_class = NULL;
757 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
758 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
759 static jfieldID Currency_LDKCurrency_Regtest = NULL;
760 static jfieldID Currency_LDKCurrency_Simnet = NULL;
761 static jfieldID Currency_LDKCurrency_Signet = NULL;
762 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
763         Currency_class = (*env)->NewGlobalRef(env, clz);
764         CHECK(Currency_class != NULL);
765         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
766         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
767         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
768         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
769         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
770         CHECK(Currency_LDKCurrency_Regtest != NULL);
771         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
772         CHECK(Currency_LDKCurrency_Simnet != NULL);
773         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
774         CHECK(Currency_LDKCurrency_Signet != NULL);
775 }
776 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
777         switch (val) {
778                 case LDKCurrency_Bitcoin:
779                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
780                 case LDKCurrency_BitcoinTestnet:
781                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
782                 case LDKCurrency_Regtest:
783                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
784                 case LDKCurrency_Simnet:
785                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
786                 case LDKCurrency_Signet:
787                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
788                 default: abort();
789         }
790 }
791
792 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
793         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
794         if (UNLIKELY((*env)->ExceptionCheck(env))) {
795                 (*env)->ExceptionDescribe(env);
796                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
797         }
798         switch (ord) {
799                 case 0: return LDKHTLCClaim_OfferedTimeout;
800                 case 1: return LDKHTLCClaim_OfferedPreimage;
801                 case 2: return LDKHTLCClaim_AcceptedTimeout;
802                 case 3: return LDKHTLCClaim_AcceptedPreimage;
803                 case 4: return LDKHTLCClaim_Revocation;
804         }
805         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
806         abort(); // Unreachable, but will let the compiler know we don't return here
807 }
808 static jclass HTLCClaim_class = NULL;
809 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
810 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
811 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
812 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
813 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
814 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
815         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
816         CHECK(HTLCClaim_class != NULL);
817         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
818         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
819         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
820         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
821         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
822         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
823         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
824         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
825         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
826         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
827 }
828 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
829         switch (val) {
830                 case LDKHTLCClaim_OfferedTimeout:
831                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
832                 case LDKHTLCClaim_OfferedPreimage:
833                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
834                 case LDKHTLCClaim_AcceptedTimeout:
835                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
836                 case LDKHTLCClaim_AcceptedPreimage:
837                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
838                 case LDKHTLCClaim_Revocation:
839                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
840                 default: abort();
841         }
842 }
843
844 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
845         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
846         if (UNLIKELY((*env)->ExceptionCheck(env))) {
847                 (*env)->ExceptionDescribe(env);
848                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
849         }
850         switch (ord) {
851                 case 0: return LDKIOError_NotFound;
852                 case 1: return LDKIOError_PermissionDenied;
853                 case 2: return LDKIOError_ConnectionRefused;
854                 case 3: return LDKIOError_ConnectionReset;
855                 case 4: return LDKIOError_ConnectionAborted;
856                 case 5: return LDKIOError_NotConnected;
857                 case 6: return LDKIOError_AddrInUse;
858                 case 7: return LDKIOError_AddrNotAvailable;
859                 case 8: return LDKIOError_BrokenPipe;
860                 case 9: return LDKIOError_AlreadyExists;
861                 case 10: return LDKIOError_WouldBlock;
862                 case 11: return LDKIOError_InvalidInput;
863                 case 12: return LDKIOError_InvalidData;
864                 case 13: return LDKIOError_TimedOut;
865                 case 14: return LDKIOError_WriteZero;
866                 case 15: return LDKIOError_Interrupted;
867                 case 16: return LDKIOError_Other;
868                 case 17: return LDKIOError_UnexpectedEof;
869         }
870         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
871         abort(); // Unreachable, but will let the compiler know we don't return here
872 }
873 static jclass IOError_class = NULL;
874 static jfieldID IOError_LDKIOError_NotFound = NULL;
875 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
876 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
877 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
878 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
879 static jfieldID IOError_LDKIOError_NotConnected = NULL;
880 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
881 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
882 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
883 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
884 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
885 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
886 static jfieldID IOError_LDKIOError_InvalidData = NULL;
887 static jfieldID IOError_LDKIOError_TimedOut = NULL;
888 static jfieldID IOError_LDKIOError_WriteZero = NULL;
889 static jfieldID IOError_LDKIOError_Interrupted = NULL;
890 static jfieldID IOError_LDKIOError_Other = NULL;
891 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
892 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
893         IOError_class = (*env)->NewGlobalRef(env, clz);
894         CHECK(IOError_class != NULL);
895         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
896         CHECK(IOError_LDKIOError_NotFound != NULL);
897         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
898         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
899         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
900         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
901         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
902         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
903         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
904         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
905         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
906         CHECK(IOError_LDKIOError_NotConnected != NULL);
907         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
908         CHECK(IOError_LDKIOError_AddrInUse != NULL);
909         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
910         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
911         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
912         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
913         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
914         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
915         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
916         CHECK(IOError_LDKIOError_WouldBlock != NULL);
917         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
918         CHECK(IOError_LDKIOError_InvalidInput != NULL);
919         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
920         CHECK(IOError_LDKIOError_InvalidData != NULL);
921         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
922         CHECK(IOError_LDKIOError_TimedOut != NULL);
923         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
924         CHECK(IOError_LDKIOError_WriteZero != NULL);
925         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
926         CHECK(IOError_LDKIOError_Interrupted != NULL);
927         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
928         CHECK(IOError_LDKIOError_Other != NULL);
929         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
930         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
931 }
932 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
933         switch (val) {
934                 case LDKIOError_NotFound:
935                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
936                 case LDKIOError_PermissionDenied:
937                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
938                 case LDKIOError_ConnectionRefused:
939                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
940                 case LDKIOError_ConnectionReset:
941                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
942                 case LDKIOError_ConnectionAborted:
943                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
944                 case LDKIOError_NotConnected:
945                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
946                 case LDKIOError_AddrInUse:
947                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
948                 case LDKIOError_AddrNotAvailable:
949                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
950                 case LDKIOError_BrokenPipe:
951                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
952                 case LDKIOError_AlreadyExists:
953                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
954                 case LDKIOError_WouldBlock:
955                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
956                 case LDKIOError_InvalidInput:
957                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
958                 case LDKIOError_InvalidData:
959                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
960                 case LDKIOError_TimedOut:
961                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
962                 case LDKIOError_WriteZero:
963                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
964                 case LDKIOError_Interrupted:
965                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
966                 case LDKIOError_Other:
967                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
968                 case LDKIOError_UnexpectedEof:
969                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
970                 default: abort();
971         }
972 }
973
974 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
975         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
976         if (UNLIKELY((*env)->ExceptionCheck(env))) {
977                 (*env)->ExceptionDescribe(env);
978                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
979         }
980         switch (ord) {
981                 case 0: return LDKLevel_Gossip;
982                 case 1: return LDKLevel_Trace;
983                 case 2: return LDKLevel_Debug;
984                 case 3: return LDKLevel_Info;
985                 case 4: return LDKLevel_Warn;
986                 case 5: return LDKLevel_Error;
987         }
988         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
989         abort(); // Unreachable, but will let the compiler know we don't return here
990 }
991 static jclass Level_class = NULL;
992 static jfieldID Level_LDKLevel_Gossip = NULL;
993 static jfieldID Level_LDKLevel_Trace = NULL;
994 static jfieldID Level_LDKLevel_Debug = NULL;
995 static jfieldID Level_LDKLevel_Info = NULL;
996 static jfieldID Level_LDKLevel_Warn = NULL;
997 static jfieldID Level_LDKLevel_Error = NULL;
998 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
999         Level_class = (*env)->NewGlobalRef(env, clz);
1000         CHECK(Level_class != NULL);
1001         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
1002         CHECK(Level_LDKLevel_Gossip != NULL);
1003         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
1004         CHECK(Level_LDKLevel_Trace != NULL);
1005         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
1006         CHECK(Level_LDKLevel_Debug != NULL);
1007         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
1008         CHECK(Level_LDKLevel_Info != NULL);
1009         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
1010         CHECK(Level_LDKLevel_Warn != NULL);
1011         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
1012         CHECK(Level_LDKLevel_Error != NULL);
1013 }
1014 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
1015         switch (val) {
1016                 case LDKLevel_Gossip:
1017                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
1018                 case LDKLevel_Trace:
1019                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
1020                 case LDKLevel_Debug:
1021                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
1022                 case LDKLevel_Info:
1023                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
1024                 case LDKLevel_Warn:
1025                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
1026                 case LDKLevel_Error:
1027                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
1028                 default: abort();
1029         }
1030 }
1031
1032 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
1033         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1034         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1035                 (*env)->ExceptionDescribe(env);
1036                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
1037         }
1038         switch (ord) {
1039                 case 0: return LDKNetwork_Bitcoin;
1040                 case 1: return LDKNetwork_Testnet;
1041                 case 2: return LDKNetwork_Regtest;
1042                 case 3: return LDKNetwork_Signet;
1043         }
1044         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
1045         abort(); // Unreachable, but will let the compiler know we don't return here
1046 }
1047 static jclass Network_class = NULL;
1048 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
1049 static jfieldID Network_LDKNetwork_Testnet = NULL;
1050 static jfieldID Network_LDKNetwork_Regtest = NULL;
1051 static jfieldID Network_LDKNetwork_Signet = NULL;
1052 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
1053         Network_class = (*env)->NewGlobalRef(env, clz);
1054         CHECK(Network_class != NULL);
1055         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
1056         CHECK(Network_LDKNetwork_Bitcoin != NULL);
1057         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
1058         CHECK(Network_LDKNetwork_Testnet != NULL);
1059         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
1060         CHECK(Network_LDKNetwork_Regtest != NULL);
1061         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
1062         CHECK(Network_LDKNetwork_Signet != NULL);
1063 }
1064 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
1065         switch (val) {
1066                 case LDKNetwork_Bitcoin:
1067                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
1068                 case LDKNetwork_Testnet:
1069                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1070                 case LDKNetwork_Regtest:
1071                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1072                 case LDKNetwork_Signet:
1073                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1074                 default: abort();
1075         }
1076 }
1077
1078 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1079         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1080         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1081                 (*env)->ExceptionDescribe(env);
1082                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1083         }
1084         switch (ord) {
1085                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1086                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1087                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1088                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1089                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1090                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1091         }
1092         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1093         abort(); // Unreachable, but will let the compiler know we don't return here
1094 }
1095 static jclass PaymentFailureReason_class = NULL;
1096 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1097 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1098 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1099 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1100 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1101 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1102 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1103         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1104         CHECK(PaymentFailureReason_class != NULL);
1105         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1106         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1107         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1108         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1109         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1110         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1111         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1112         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1113         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1114         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1115         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1116         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1117 }
1118 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1119         switch (val) {
1120                 case LDKPaymentFailureReason_RecipientRejected:
1121                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1122                 case LDKPaymentFailureReason_UserAbandoned:
1123                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1124                 case LDKPaymentFailureReason_RetriesExhausted:
1125                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1126                 case LDKPaymentFailureReason_PaymentExpired:
1127                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1128                 case LDKPaymentFailureReason_RouteNotFound:
1129                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1130                 case LDKPaymentFailureReason_UnexpectedError:
1131                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1132                 default: abort();
1133         }
1134 }
1135
1136 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1137         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1138         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1139                 (*env)->ExceptionDescribe(env);
1140                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1141         }
1142         switch (ord) {
1143                 case 0: return LDKRecipient_Node;
1144                 case 1: return LDKRecipient_PhantomNode;
1145         }
1146         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1147         abort(); // Unreachable, but will let the compiler know we don't return here
1148 }
1149 static jclass Recipient_class = NULL;
1150 static jfieldID Recipient_LDKRecipient_Node = NULL;
1151 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1152 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1153         Recipient_class = (*env)->NewGlobalRef(env, clz);
1154         CHECK(Recipient_class != NULL);
1155         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1156         CHECK(Recipient_LDKRecipient_Node != NULL);
1157         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1158         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1159 }
1160 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1161         switch (val) {
1162                 case LDKRecipient_Node:
1163                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1164                 case LDKRecipient_PhantomNode:
1165                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1166                 default: abort();
1167         }
1168 }
1169
1170 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1171         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1172         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1173                 (*env)->ExceptionDescribe(env);
1174                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1175         }
1176         switch (ord) {
1177                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1178                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1179                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1180         }
1181         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1182         abort(); // Unreachable, but will let the compiler know we don't return here
1183 }
1184 static jclass RetryableSendFailure_class = NULL;
1185 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1186 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1187 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1188 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1189         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1190         CHECK(RetryableSendFailure_class != NULL);
1191         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1192         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1193         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1194         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1195         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1196         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1197 }
1198 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1199         switch (val) {
1200                 case LDKRetryableSendFailure_PaymentExpired:
1201                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1202                 case LDKRetryableSendFailure_RouteNotFound:
1203                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1204                 case LDKRetryableSendFailure_DuplicatePayment:
1205                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1206                 default: abort();
1207         }
1208 }
1209
1210 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1211         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1212         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1213                 (*env)->ExceptionDescribe(env);
1214                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1215         }
1216         switch (ord) {
1217                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1218                 case 1: return LDKSecp256k1Error_InvalidMessage;
1219                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1220                 case 3: return LDKSecp256k1Error_InvalidSignature;
1221                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1222                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1223                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1224                 case 7: return LDKSecp256k1Error_InvalidTweak;
1225                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1226                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1227                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1228         }
1229         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1230         abort(); // Unreachable, but will let the compiler know we don't return here
1231 }
1232 static jclass Secp256k1Error_class = NULL;
1233 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1234 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1235 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1236 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1237 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1238 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1239 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1240 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1241 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1242 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1243 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1244 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1245         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1246         CHECK(Secp256k1Error_class != NULL);
1247         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1248         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1249         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1250         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1251         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1252         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1253         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1254         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1255         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1256         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1257         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1258         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1259         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1260         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1261         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1262         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1263         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1264         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1265         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1266         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1267         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1268         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1269 }
1270 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1271         switch (val) {
1272                 case LDKSecp256k1Error_IncorrectSignature:
1273                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1274                 case LDKSecp256k1Error_InvalidMessage:
1275                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1276                 case LDKSecp256k1Error_InvalidPublicKey:
1277                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1278                 case LDKSecp256k1Error_InvalidSignature:
1279                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1280                 case LDKSecp256k1Error_InvalidSecretKey:
1281                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1282                 case LDKSecp256k1Error_InvalidSharedSecret:
1283                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1284                 case LDKSecp256k1Error_InvalidRecoveryId:
1285                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1286                 case LDKSecp256k1Error_InvalidTweak:
1287                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1288                 case LDKSecp256k1Error_NotEnoughMemory:
1289                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1290                 case LDKSecp256k1Error_InvalidPublicKeySum:
1291                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1292                 case LDKSecp256k1Error_InvalidParityValue:
1293                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1294                 default: abort();
1295         }
1296 }
1297
1298 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1299         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1300         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1301                 (*env)->ExceptionDescribe(env);
1302                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1303         }
1304         switch (ord) {
1305                 case 0: return LDKSiPrefix_Milli;
1306                 case 1: return LDKSiPrefix_Micro;
1307                 case 2: return LDKSiPrefix_Nano;
1308                 case 3: return LDKSiPrefix_Pico;
1309         }
1310         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1311         abort(); // Unreachable, but will let the compiler know we don't return here
1312 }
1313 static jclass SiPrefix_class = NULL;
1314 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1315 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1316 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1317 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1318 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1319         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1320         CHECK(SiPrefix_class != NULL);
1321         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1322         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1323         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1324         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1325         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1326         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1327         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1328         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1329 }
1330 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1331         switch (val) {
1332                 case LDKSiPrefix_Milli:
1333                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1334                 case LDKSiPrefix_Micro:
1335                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1336                 case LDKSiPrefix_Nano:
1337                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1338                 case LDKSiPrefix_Pico:
1339                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1340                 default: abort();
1341         }
1342 }
1343
1344 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_java(JNIEnv *env, jclass clz) {
1345         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1346         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1347                 (*env)->ExceptionDescribe(env);
1348                 (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust threw an exception.");
1349         }
1350         switch (ord) {
1351                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
1352                 case 1: return LDKSocketAddressParseError_InvalidInput;
1353                 case 2: return LDKSocketAddressParseError_InvalidPort;
1354                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
1355         }
1356         (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust returned an invalid value.");
1357         abort(); // Unreachable, but will let the compiler know we don't return here
1358 }
1359 static jclass SocketAddressParseError_class = NULL;
1360 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = NULL;
1361 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = NULL;
1362 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = NULL;
1363 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = NULL;
1364 JNIEXPORT void JNICALL Java_org_ldk_enums_SocketAddressParseError_init (JNIEnv *env, jclass clz) {
1365         SocketAddressParseError_class = (*env)->NewGlobalRef(env, clz);
1366         CHECK(SocketAddressParseError_class != NULL);
1367         SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_SocketAddrParse", "Lorg/ldk/enums/SocketAddressParseError;");
1368         CHECK(SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse != NULL);
1369         SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidInput", "Lorg/ldk/enums/SocketAddressParseError;");
1370         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidInput != NULL);
1371         SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidPort", "Lorg/ldk/enums/SocketAddressParseError;");
1372         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidPort != NULL);
1373         SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidOnionV3", "Lorg/ldk/enums/SocketAddressParseError;");
1374         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 != NULL);
1375 }
1376 static inline jclass LDKSocketAddressParseError_to_java(JNIEnv *env, LDKSocketAddressParseError val) {
1377         switch (val) {
1378                 case LDKSocketAddressParseError_SocketAddrParse:
1379                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse);
1380                 case LDKSocketAddressParseError_InvalidInput:
1381                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidInput);
1382                 case LDKSocketAddressParseError_InvalidPort:
1383                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidPort);
1384                 case LDKSocketAddressParseError_InvalidOnionV3:
1385                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3);
1386                 default: abort();
1387         }
1388 }
1389
1390 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1391         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1392         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1393                 (*env)->ExceptionDescribe(env);
1394                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1395         }
1396         switch (ord) {
1397                 case 0: return LDKUtxoLookupError_UnknownChain;
1398                 case 1: return LDKUtxoLookupError_UnknownTx;
1399         }
1400         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1401         abort(); // Unreachable, but will let the compiler know we don't return here
1402 }
1403 static jclass UtxoLookupError_class = NULL;
1404 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1405 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1406 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1407         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1408         CHECK(UtxoLookupError_class != NULL);
1409         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1410         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1411         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1412         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1413 }
1414 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1415         switch (val) {
1416                 case LDKUtxoLookupError_UnknownChain:
1417                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1418                 case LDKUtxoLookupError_UnknownTx:
1419                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1420                 default: abort();
1421         }
1422 }
1423
1424 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1425         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1426         return ret;
1427 }
1428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1429         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1430         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1431         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1432         return ret_arr;
1433 }
1434
1435 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1437         if (!ptr_is_owned(thing)) return;
1438         void* thing_ptr = untag_ptr(thing);
1439         CHECK_ACCESS(thing_ptr);
1440         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1441         FREE(untag_ptr(thing));
1442         BigEndianScalar_free(thing_conv);
1443 }
1444
1445 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1446 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1447 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1448 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1449 static jclass LDKBech32Error_InvalidLength_class = NULL;
1450 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1451 static jclass LDKBech32Error_InvalidChar_class = NULL;
1452 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1453 static jclass LDKBech32Error_InvalidData_class = NULL;
1454 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1455 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1456 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1457 static jclass LDKBech32Error_MixedCase_class = NULL;
1458 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1460         LDKBech32Error_MissingSeparator_class =
1461                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1462         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1463         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1464         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1465         LDKBech32Error_InvalidChecksum_class =
1466                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1467         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1468         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1469         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1470         LDKBech32Error_InvalidLength_class =
1471                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1472         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1473         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1474         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1475         LDKBech32Error_InvalidChar_class =
1476                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1477         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1478         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1479         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1480         LDKBech32Error_InvalidData_class =
1481                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1482         CHECK(LDKBech32Error_InvalidData_class != NULL);
1483         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1484         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1485         LDKBech32Error_InvalidPadding_class =
1486                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1487         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1488         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1489         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1490         LDKBech32Error_MixedCase_class =
1491                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1492         CHECK(LDKBech32Error_MixedCase_class != NULL);
1493         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1494         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1495 }
1496 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1497         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1498         switch(obj->tag) {
1499                 case LDKBech32Error_MissingSeparator: {
1500                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1501                 }
1502                 case LDKBech32Error_InvalidChecksum: {
1503                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1504                 }
1505                 case LDKBech32Error_InvalidLength: {
1506                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1507                 }
1508                 case LDKBech32Error_InvalidChar: {
1509                         int32_t invalid_char_conv = obj->invalid_char;
1510                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1511                 }
1512                 case LDKBech32Error_InvalidData: {
1513                         int8_t invalid_data_conv = obj->invalid_data;
1514                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1515                 }
1516                 case LDKBech32Error_InvalidPadding: {
1517                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1518                 }
1519                 case LDKBech32Error_MixedCase: {
1520                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1521                 }
1522                 default: abort();
1523         }
1524 }
1525 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1526         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1527         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1528         return ret;
1529 }
1530 struct LDKWitness TxIn_get_witness (struct LDKTxIn* thing) {    return Witness_clone(&thing->witness);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1witness(JNIEnv *env, jclass clz, int64_t thing) {
1531         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1532         LDKWitness ret_var = TxIn_get_witness(thing_conv);
1533         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1534         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1535         Witness_free(ret_var);
1536         return ret_arr;
1537 }
1538
1539 struct LDKCVec_u8Z TxIn_get_script_sig (struct LDKTxIn* thing) {        return CVec_u8Z_clone(&thing->script_sig);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1script_1sig(JNIEnv *env, jclass clz, int64_t thing) {
1540         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1541         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
1542         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1543         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1544         CVec_u8Z_free(ret_var);
1545         return ret_arr;
1546 }
1547
1548 LDKThirtyTwoBytes TxIn_get_previous_txid (struct LDKTxIn* thing) {      return thing->previous_txid;}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1txid(JNIEnv *env, jclass clz, int64_t thing) {
1549         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1550         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1551         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(thing_conv).data);
1552         return ret_arr;
1553 }
1554
1555 uint32_t TxIn_get_previous_vout (struct LDKTxIn* thing) {       return thing->previous_vout;}JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1vout(JNIEnv *env, jclass clz, int64_t thing) {
1556         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1557         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
1558         return ret_conv;
1559 }
1560
1561 uint32_t TxIn_get_sequence (struct LDKTxIn* thing) {    return thing->sequence;}JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1sequence(JNIEnv *env, jclass clz, int64_t thing) {
1562         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1563         int32_t ret_conv = TxIn_get_sequence(thing_conv);
1564         return ret_conv;
1565 }
1566
1567 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) {   return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
1568         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1569         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1570         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1571         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1572         CVec_u8Z_free(ret_var);
1573         return ret_arr;
1574 }
1575
1576 uint64_t TxOut_get_value (struct LDKTxOut* thing) {     return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
1577         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1578         int64_t ret_conv = TxOut_get_value(thing_conv);
1579         return ret_conv;
1580 }
1581
1582 static jclass LDKCOption_u64Z_Some_class = NULL;
1583 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1584 static jclass LDKCOption_u64Z_None_class = NULL;
1585 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1587         LDKCOption_u64Z_Some_class =
1588                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1589         CHECK(LDKCOption_u64Z_Some_class != NULL);
1590         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1591         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1592         LDKCOption_u64Z_None_class =
1593                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1594         CHECK(LDKCOption_u64Z_None_class != NULL);
1595         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1596         CHECK(LDKCOption_u64Z_None_meth != NULL);
1597 }
1598 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1599         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1600         switch(obj->tag) {
1601                 case LDKCOption_u64Z_Some: {
1602                         int64_t some_conv = obj->some;
1603                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1604                 }
1605                 case LDKCOption_u64Z_None: {
1606                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1607                 }
1608                 default: abort();
1609         }
1610 }
1611 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1612         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1613         for (size_t i = 0; i < ret.datalen; i++) {
1614                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1615         }
1616         return ret;
1617 }
1618 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1619         LDKRefund ret = *owner->contents.result;
1620         ret.is_owned = false;
1621         return ret;
1622 }
1623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1624         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1625         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1626         int64_t ret_ref = 0;
1627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1629         return ret_ref;
1630 }
1631
1632 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1633         LDKBolt12ParseError ret = *owner->contents.err;
1634         ret.is_owned = false;
1635         return ret;
1636 }
1637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1638         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1639         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1640         int64_t ret_ref = 0;
1641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1643         return ret_ref;
1644 }
1645
1646 static jclass LDKRetry_Attempts_class = NULL;
1647 static jmethodID LDKRetry_Attempts_meth = NULL;
1648 static jclass LDKRetry_Timeout_class = NULL;
1649 static jmethodID LDKRetry_Timeout_meth = NULL;
1650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
1651         LDKRetry_Attempts_class =
1652                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
1653         CHECK(LDKRetry_Attempts_class != NULL);
1654         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(I)V");
1655         CHECK(LDKRetry_Attempts_meth != NULL);
1656         LDKRetry_Timeout_class =
1657                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
1658         CHECK(LDKRetry_Timeout_class != NULL);
1659         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
1660         CHECK(LDKRetry_Timeout_meth != NULL);
1661 }
1662 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1663         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1664         switch(obj->tag) {
1665                 case LDKRetry_Attempts: {
1666                         int32_t attempts_conv = obj->attempts;
1667                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
1668                 }
1669                 case LDKRetry_Timeout: {
1670                         int64_t timeout_conv = obj->timeout;
1671                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
1672                 }
1673                 default: abort();
1674         }
1675 }
1676 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1677 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1678 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1679 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1680 static jclass LDKDecodeError_InvalidValue_class = NULL;
1681 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1682 static jclass LDKDecodeError_ShortRead_class = NULL;
1683 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1684 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1685 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1686 static jclass LDKDecodeError_Io_class = NULL;
1687 static jmethodID LDKDecodeError_Io_meth = NULL;
1688 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1689 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1691         LDKDecodeError_UnknownVersion_class =
1692                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1693         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1694         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1695         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1696         LDKDecodeError_UnknownRequiredFeature_class =
1697                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1698         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1699         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1700         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1701         LDKDecodeError_InvalidValue_class =
1702                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1703         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1704         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1705         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1706         LDKDecodeError_ShortRead_class =
1707                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1708         CHECK(LDKDecodeError_ShortRead_class != NULL);
1709         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1710         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1711         LDKDecodeError_BadLengthDescriptor_class =
1712                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1713         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1714         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1715         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1716         LDKDecodeError_Io_class =
1717                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1718         CHECK(LDKDecodeError_Io_class != NULL);
1719         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1720         CHECK(LDKDecodeError_Io_meth != NULL);
1721         LDKDecodeError_UnsupportedCompression_class =
1722                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1723         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1724         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1725         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1726 }
1727 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1728         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1729         switch(obj->tag) {
1730                 case LDKDecodeError_UnknownVersion: {
1731                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1732                 }
1733                 case LDKDecodeError_UnknownRequiredFeature: {
1734                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1735                 }
1736                 case LDKDecodeError_InvalidValue: {
1737                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1738                 }
1739                 case LDKDecodeError_ShortRead: {
1740                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1741                 }
1742                 case LDKDecodeError_BadLengthDescriptor: {
1743                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1744                 }
1745                 case LDKDecodeError_Io: {
1746                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1747                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1748                 }
1749                 case LDKDecodeError_UnsupportedCompression: {
1750                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1751                 }
1752                 default: abort();
1753         }
1754 }
1755 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1756 CHECK(owner->result_ok);
1757         return Retry_clone(&*owner->contents.result);
1758 }
1759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1760         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1761         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1762         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1763         int64_t ret_ref = tag_ptr(ret_copy, true);
1764         return ret_ref;
1765 }
1766
1767 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1768 CHECK(!owner->result_ok);
1769         return DecodeError_clone(&*owner->contents.err);
1770 }
1771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1772         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1773         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1774         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
1775         int64_t ret_ref = tag_ptr(ret_copy, true);
1776         return ret_ref;
1777 }
1778
1779 static jclass LDKAPIError_APIMisuseError_class = NULL;
1780 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1781 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1782 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1783 static jclass LDKAPIError_InvalidRoute_class = NULL;
1784 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1785 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1786 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1787 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1788 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1789 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1790 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1792         LDKAPIError_APIMisuseError_class =
1793                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1794         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1795         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1796         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1797         LDKAPIError_FeeRateTooHigh_class =
1798                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1799         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1800         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1801         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1802         LDKAPIError_InvalidRoute_class =
1803                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1804         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1805         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1806         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1807         LDKAPIError_ChannelUnavailable_class =
1808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1809         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1810         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1811         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1812         LDKAPIError_MonitorUpdateInProgress_class =
1813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1814         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1815         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1816         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1817         LDKAPIError_IncompatibleShutdownScript_class =
1818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1819         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1820         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1821         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1822 }
1823 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1824         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1825         switch(obj->tag) {
1826                 case LDKAPIError_APIMisuseError: {
1827                         LDKStr err_str = obj->api_misuse_error.err;
1828                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1829                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1830                 }
1831                 case LDKAPIError_FeeRateTooHigh: {
1832                         LDKStr err_str = obj->fee_rate_too_high.err;
1833                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1834                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1835                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1836                 }
1837                 case LDKAPIError_InvalidRoute: {
1838                         LDKStr err_str = obj->invalid_route.err;
1839                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1840                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1841                 }
1842                 case LDKAPIError_ChannelUnavailable: {
1843                         LDKStr err_str = obj->channel_unavailable.err;
1844                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1845                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1846                 }
1847                 case LDKAPIError_MonitorUpdateInProgress: {
1848                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1849                 }
1850                 case LDKAPIError_IncompatibleShutdownScript: {
1851                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1852                         int64_t script_ref = 0;
1853                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1854                         script_ref = tag_ptr(script_var.inner, false);
1855                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
1856                 }
1857                 default: abort();
1858         }
1859 }
1860 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1861 CHECK(owner->result_ok);
1862         return *owner->contents.result;
1863 }
1864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1865         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1866         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1867 }
1868
1869 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1870 CHECK(!owner->result_ok);
1871         return APIError_clone(&*owner->contents.err);
1872 }
1873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1874         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1875         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1876         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1877         int64_t ret_ref = tag_ptr(ret_copy, true);
1878         return ret_ref;
1879 }
1880
1881 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1882         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1883         for (size_t i = 0; i < ret.datalen; i++) {
1884                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1885         }
1886         return ret;
1887 }
1888 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1889         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1890         for (size_t i = 0; i < ret.datalen; i++) {
1891                 ret.data[i] = APIError_clone(&orig->data[i]);
1892         }
1893         return ret;
1894 }
1895 static jclass LDKCOption_ThirtyTwoBytesZ_Some_class = NULL;
1896 static jmethodID LDKCOption_ThirtyTwoBytesZ_Some_meth = NULL;
1897 static jclass LDKCOption_ThirtyTwoBytesZ_None_class = NULL;
1898 static jmethodID LDKCOption_ThirtyTwoBytesZ_None_meth = NULL;
1899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ThirtyTwoBytesZ_init (JNIEnv *env, jclass clz) {
1900         LDKCOption_ThirtyTwoBytesZ_Some_class =
1901                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$Some"));
1902         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_class != NULL);
1903         LDKCOption_ThirtyTwoBytesZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_Some_class, "<init>", "([B)V");
1904         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_meth != NULL);
1905         LDKCOption_ThirtyTwoBytesZ_None_class =
1906                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$None"));
1907         CHECK(LDKCOption_ThirtyTwoBytesZ_None_class != NULL);
1908         LDKCOption_ThirtyTwoBytesZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_None_class, "<init>", "()V");
1909         CHECK(LDKCOption_ThirtyTwoBytesZ_None_meth != NULL);
1910 }
1911 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ThirtyTwoBytesZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1912         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1913         switch(obj->tag) {
1914                 case LDKCOption_ThirtyTwoBytesZ_Some: {
1915                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
1916                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
1917                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_Some_class, LDKCOption_ThirtyTwoBytesZ_Some_meth, some_arr);
1918                 }
1919                 case LDKCOption_ThirtyTwoBytesZ_None: {
1920                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_None_class, LDKCOption_ThirtyTwoBytesZ_None_meth);
1921                 }
1922                 default: abort();
1923         }
1924 }
1925 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
1926 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
1927 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
1928 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
1929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
1930         LDKCOption_CVec_u8ZZ_Some_class =
1931                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
1932         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
1933         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
1934         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
1935         LDKCOption_CVec_u8ZZ_None_class =
1936                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
1937         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
1938         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
1939         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
1940 }
1941 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1942         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1943         switch(obj->tag) {
1944                 case LDKCOption_CVec_u8ZZ_Some: {
1945                         LDKCVec_u8Z some_var = obj->some;
1946                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
1947                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
1948                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
1949                 }
1950                 case LDKCOption_CVec_u8ZZ_None: {
1951                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
1952                 }
1953                 default: abort();
1954         }
1955 }
1956 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1957         LDKRecipientOnionFields ret = *owner->contents.result;
1958         ret.is_owned = false;
1959         return ret;
1960 }
1961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1962         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1963         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1964         int64_t ret_ref = 0;
1965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1967         return ret_ref;
1968 }
1969
1970 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1971 CHECK(!owner->result_ok);
1972         return DecodeError_clone(&*owner->contents.err);
1973 }
1974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1975         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1976         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1977         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1978         int64_t ret_ref = tag_ptr(ret_copy, true);
1979         return ret_ref;
1980 }
1981
1982 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1983         return owner->a;
1984 }
1985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
1986         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1987         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1988         return ret_conv;
1989 }
1990
1991 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1992         return CVec_u8Z_clone(&owner->b);
1993 }
1994 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
1995         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1996         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1997         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1998         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1999         CVec_u8Z_free(ret_var);
2000         return ret_arr;
2001 }
2002
2003 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
2004         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
2005         for (size_t i = 0; i < ret.datalen; i++) {
2006                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
2007         }
2008         return ret;
2009 }
2010 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2011         LDKRecipientOnionFields ret = *owner->contents.result;
2012         ret.is_owned = false;
2013         return ret;
2014 }
2015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2016         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2017         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
2018         int64_t ret_ref = 0;
2019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2021         return ret_ref;
2022 }
2023
2024 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2025 CHECK(!owner->result_ok);
2026         return *owner->contents.err;
2027 }
2028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2029         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2030         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
2031 }
2032
2033 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
2034         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
2035         for (size_t i = 0; i < ret.datalen; i++) {
2036                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2037         }
2038         return ret;
2039 }
2040 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class = NULL;
2041 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = NULL;
2042 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_None_class = NULL;
2043 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = NULL;
2044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ThirtyTwoBytesZZ_init (JNIEnv *env, jclass clz) {
2045         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class =
2046                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$Some"));
2047         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class != NULL);
2048         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, "<init>", "([[B)V");
2049         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth != NULL);
2050         LDKCOption_CVec_ThirtyTwoBytesZZ_None_class =
2051                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$None"));
2052         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_class != NULL);
2053         LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, "<init>", "()V");
2054         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth != NULL);
2055 }
2056 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ThirtyTwoBytesZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2057         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
2058         switch(obj->tag) {
2059                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: {
2060                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
2061                         jobjectArray some_arr = NULL;
2062                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
2063                         ;
2064                         for (size_t i = 0; i < some_var.datalen; i++) {
2065                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
2066                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
2067                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
2068                         }
2069                         
2070                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth, some_arr);
2071                 }
2072                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: {
2073                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth);
2074                 }
2075                 default: abort();
2076         }
2077 }
2078 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2079 CHECK(owner->result_ok);
2080         return ThirtyTwoBytes_clone(&*owner->contents.result);
2081 }
2082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2083         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2084         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2085         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data);
2086         return ret_arr;
2087 }
2088
2089 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2090 CHECK(!owner->result_ok);
2091         return *owner->contents.err;
2092 }
2093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2094         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2095         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
2096 }
2097
2098 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2099         LDKBlindedPayInfo ret = *owner->contents.result;
2100         ret.is_owned = false;
2101         return ret;
2102 }
2103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2104         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2105         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
2106         int64_t ret_ref = 0;
2107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2109         return ret_ref;
2110 }
2111
2112 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2113 CHECK(!owner->result_ok);
2114         return DecodeError_clone(&*owner->contents.err);
2115 }
2116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2117         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2118         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2119         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
2120         int64_t ret_ref = tag_ptr(ret_copy, true);
2121         return ret_ref;
2122 }
2123
2124 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2125         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
2126         ret.is_owned = false;
2127         return ret;
2128 }
2129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2130         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2131         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2132         int64_t ret_ref = 0;
2133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2135         return ret_ref;
2136 }
2137
2138 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2139 CHECK(!owner->result_ok);
2140         return DecodeError_clone(&*owner->contents.err);
2141 }
2142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2143         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2144         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2145         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2146         int64_t ret_ref = tag_ptr(ret_copy, true);
2147         return ret_ref;
2148 }
2149
2150 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2151         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
2152         ret.is_owned = false;
2153         return ret;
2154 }
2155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2156         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2157         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2158         int64_t ret_ref = 0;
2159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2161         return ret_ref;
2162 }
2163
2164 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2165 CHECK(!owner->result_ok);
2166         return DecodeError_clone(&*owner->contents.err);
2167 }
2168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2169         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2170         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2171         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2172         int64_t ret_ref = tag_ptr(ret_copy, true);
2173         return ret_ref;
2174 }
2175
2176 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2177 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2178 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2179 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2180 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2181 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2183         LDKSpendableOutputDescriptor_StaticOutput_class =
2184                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2185         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2186         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2187         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2188         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2189                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2190         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2191         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2192         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2193         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2194                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2195         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2196         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2197         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2198 }
2199 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2200         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2201         switch(obj->tag) {
2202                 case LDKSpendableOutputDescriptor_StaticOutput: {
2203                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2204                         int64_t outpoint_ref = 0;
2205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2206                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2207                         LDKTxOut* output_ref = &obj->static_output.output;
2208                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
2209                 }
2210                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2211                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2212                         int64_t delayed_payment_output_ref = 0;
2213                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2214                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2215                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2216                 }
2217                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2218                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2219                         int64_t static_payment_output_ref = 0;
2220                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2221                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2222                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2223                 }
2224                 default: abort();
2225         }
2226 }
2227 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2228 CHECK(owner->result_ok);
2229         return SpendableOutputDescriptor_clone(&*owner->contents.result);
2230 }
2231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2232         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2233         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2234         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2235         int64_t ret_ref = tag_ptr(ret_copy, true);
2236         return ret_ref;
2237 }
2238
2239 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2240 CHECK(!owner->result_ok);
2241         return DecodeError_clone(&*owner->contents.err);
2242 }
2243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2244         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2245         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2246         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2247         int64_t ret_ref = tag_ptr(ret_copy, true);
2248         return ret_ref;
2249 }
2250
2251 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2252         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2253         for (size_t i = 0; i < ret.datalen; i++) {
2254                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2255         }
2256         return ret;
2257 }
2258 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2259         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2260         for (size_t i = 0; i < ret.datalen; i++) {
2261                 ret.data[i] = TxOut_clone(&orig->data[i]);
2262         }
2263         return ret;
2264 }
2265 static jclass LDKCOption_u32Z_Some_class = NULL;
2266 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
2267 static jclass LDKCOption_u32Z_None_class = NULL;
2268 static jmethodID LDKCOption_u32Z_None_meth = NULL;
2269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
2270         LDKCOption_u32Z_Some_class =
2271                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
2272         CHECK(LDKCOption_u32Z_Some_class != NULL);
2273         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
2274         CHECK(LDKCOption_u32Z_Some_meth != NULL);
2275         LDKCOption_u32Z_None_class =
2276                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
2277         CHECK(LDKCOption_u32Z_None_class != NULL);
2278         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
2279         CHECK(LDKCOption_u32Z_None_meth != NULL);
2280 }
2281 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2282         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
2283         switch(obj->tag) {
2284                 case LDKCOption_u32Z_Some: {
2285                         int32_t some_conv = obj->some;
2286                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
2287                 }
2288                 case LDKCOption_u32Z_None: {
2289                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
2290                 }
2291                 default: abort();
2292         }
2293 }
2294 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8ZusizeZ_get_a(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
2295         return CVec_u8Z_clone(&owner->a);
2296 }
2297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2298         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
2299         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8ZusizeZ_get_a(owner_conv);
2300         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2301         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2302         CVec_u8Z_free(ret_var);
2303         return ret_arr;
2304 }
2305
2306 static inline uintptr_t C2Tuple_CVec_u8ZusizeZ_get_b(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
2307         return owner->b;
2308 }
2309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2310         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
2311         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_get_b(owner_conv);
2312         return ret_conv;
2313 }
2314
2315 static inline struct LDKC2Tuple_CVec_u8ZusizeZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
2316 CHECK(owner->result_ok);
2317         return C2Tuple_CVec_u8ZusizeZ_clone(&*owner->contents.result);
2318 }
2319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2320         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
2321         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
2322         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(owner_conv);
2323         return tag_ptr(ret_conv, true);
2324 }
2325
2326 static inline void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
2327 CHECK(!owner->result_ok);
2328         return *owner->contents.err;
2329 }
2330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2331         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
2332         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(owner_conv);
2333 }
2334
2335 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2336 CHECK(owner->result_ok);
2337         return *owner->contents.result;
2338 }
2339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2340         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2341         CResult_NoneNoneZ_get_ok(owner_conv);
2342 }
2343
2344 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2345 CHECK(!owner->result_ok);
2346         return *owner->contents.err;
2347 }
2348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2349         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2350         CResult_NoneNoneZ_get_err(owner_conv);
2351 }
2352
2353 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2354         return owner->a;
2355 }
2356 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2357         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2358         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2359         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form);
2360         return ret_arr;
2361 }
2362
2363 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2364         return owner->b;
2365 }
2366 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2367         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2368         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
2369         jobjectArray ret_arr = NULL;
2370         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2371         ;
2372         for (size_t i = 0; i < ret_var.datalen; i++) {
2373                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2374                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2375                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2376         }
2377         
2378         return ret_arr;
2379 }
2380
2381 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2382 CHECK(owner->result_ok);
2383         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
2384 }
2385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2386         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2387         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
2388         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
2389         return tag_ptr(ret_conv, true);
2390 }
2391
2392 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2393 CHECK(!owner->result_ok);
2394         return *owner->contents.err;
2395 }
2396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2397         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2398         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
2399 }
2400
2401 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2402 CHECK(owner->result_ok);
2403         return *owner->contents.result;
2404 }
2405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2406         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2407         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2408         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form);
2409         return ret_arr;
2410 }
2411
2412 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2413 CHECK(!owner->result_ok);
2414         return *owner->contents.err;
2415 }
2416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2417         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2418         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
2419 }
2420
2421 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2422 CHECK(owner->result_ok);
2423         return *owner->contents.result;
2424 }
2425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2426         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2427         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2428         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2429         return ret_arr;
2430 }
2431
2432 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2433 CHECK(!owner->result_ok);
2434         return *owner->contents.err;
2435 }
2436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2437         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2438         CResult_PublicKeyNoneZ_get_err(owner_conv);
2439 }
2440
2441 static jclass LDKCOption_BigEndianScalarZ_Some_class = NULL;
2442 static jmethodID LDKCOption_BigEndianScalarZ_Some_meth = NULL;
2443 static jclass LDKCOption_BigEndianScalarZ_None_class = NULL;
2444 static jmethodID LDKCOption_BigEndianScalarZ_None_meth = NULL;
2445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BigEndianScalarZ_init (JNIEnv *env, jclass clz) {
2446         LDKCOption_BigEndianScalarZ_Some_class =
2447                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$Some"));
2448         CHECK(LDKCOption_BigEndianScalarZ_Some_class != NULL);
2449         LDKCOption_BigEndianScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_Some_class, "<init>", "(J)V");
2450         CHECK(LDKCOption_BigEndianScalarZ_Some_meth != NULL);
2451         LDKCOption_BigEndianScalarZ_None_class =
2452                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$None"));
2453         CHECK(LDKCOption_BigEndianScalarZ_None_class != NULL);
2454         LDKCOption_BigEndianScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_None_class, "<init>", "()V");
2455         CHECK(LDKCOption_BigEndianScalarZ_None_meth != NULL);
2456 }
2457 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BigEndianScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2458         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
2459         switch(obj->tag) {
2460                 case LDKCOption_BigEndianScalarZ_Some: {
2461                         LDKBigEndianScalar* some_ref = &obj->some;
2462                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_Some_class, LDKCOption_BigEndianScalarZ_Some_meth, tag_ptr(some_ref, false));
2463                 }
2464                 case LDKCOption_BigEndianScalarZ_None: {
2465                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_None_class, LDKCOption_BigEndianScalarZ_None_meth);
2466                 }
2467                 default: abort();
2468         }
2469 }
2470 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2471 CHECK(owner->result_ok);
2472         return *owner->contents.result;
2473 }
2474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2475         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2476         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2477         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2478         return ret_arr;
2479 }
2480
2481 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2482 CHECK(!owner->result_ok);
2483         return *owner->contents.err;
2484 }
2485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2486         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2487         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2488 }
2489
2490 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2491 CHECK(owner->result_ok);
2492         return *owner->contents.result;
2493 }
2494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2495         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2496         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2497         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form);
2498         return ret_arr;
2499 }
2500
2501 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2502 CHECK(!owner->result_ok);
2503         return *owner->contents.err;
2504 }
2505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2506         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2507         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
2508 }
2509
2510 typedef struct LDKChannelSigner_JCalls {
2511         atomic_size_t refcnt;
2512         JavaVM *vm;
2513         jweak o;
2514         jmethodID get_per_commitment_point_meth;
2515         jmethodID release_commitment_secret_meth;
2516         jmethodID validate_holder_commitment_meth;
2517         jmethodID channel_keys_id_meth;
2518         jmethodID provide_channel_parameters_meth;
2519 } LDKChannelSigner_JCalls;
2520 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2521         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2522         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2523                 JNIEnv *env;
2524                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2525                 if (get_jenv_res == JNI_EDETACHED) {
2526                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2527                 } else {
2528                         DO_ASSERT(get_jenv_res == JNI_OK);
2529                 }
2530                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2531                 if (get_jenv_res == JNI_EDETACHED) {
2532                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2533                 }
2534                 FREE(j_calls);
2535         }
2536 }
2537 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2538         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2539         JNIEnv *env;
2540         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2541         if (get_jenv_res == JNI_EDETACHED) {
2542                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2543         } else {
2544                 DO_ASSERT(get_jenv_res == JNI_OK);
2545         }
2546         int64_t idx_conv = idx;
2547         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2548         CHECK(obj != NULL);
2549         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2550         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2551                 (*env)->ExceptionDescribe(env);
2552                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2553         }
2554         LDKPublicKey ret_ref;
2555         CHECK((*env)->GetArrayLength(env, ret) == 33);
2556         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2557         if (get_jenv_res == JNI_EDETACHED) {
2558                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2559         }
2560         return ret_ref;
2561 }
2562 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2563         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2564         JNIEnv *env;
2565         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2566         if (get_jenv_res == JNI_EDETACHED) {
2567                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2568         } else {
2569                 DO_ASSERT(get_jenv_res == JNI_OK);
2570         }
2571         int64_t idx_conv = idx;
2572         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2573         CHECK(obj != NULL);
2574         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2575         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2576                 (*env)->ExceptionDescribe(env);
2577                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2578         }
2579         LDKThirtyTwoBytes ret_ref;
2580         CHECK((*env)->GetArrayLength(env, ret) == 32);
2581         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2582         if (get_jenv_res == JNI_EDETACHED) {
2583                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2584         }
2585         return ret_ref;
2586 }
2587 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
2588         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2589         JNIEnv *env;
2590         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2591         if (get_jenv_res == JNI_EDETACHED) {
2592                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2593         } else {
2594                 DO_ASSERT(get_jenv_res == JNI_OK);
2595         }
2596         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2597         int64_t holder_tx_ref = 0;
2598         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2599         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2600         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2601         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
2602         jobjectArray preimages_arr = NULL;
2603         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2604         ;
2605         for (size_t i = 0; i < preimages_var.datalen; i++) {
2606                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2607                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2608                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2609         }
2610         
2611         FREE(preimages_var.data);
2612         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2613         CHECK(obj != NULL);
2614         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
2615         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2616                 (*env)->ExceptionDescribe(env);
2617                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
2618         }
2619         void* ret_ptr = untag_ptr(ret);
2620         CHECK_ACCESS(ret_ptr);
2621         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2622         FREE(untag_ptr(ret));
2623         if (get_jenv_res == JNI_EDETACHED) {
2624                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2625         }
2626         return ret_conv;
2627 }
2628 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
2629         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2630         JNIEnv *env;
2631         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2632         if (get_jenv_res == JNI_EDETACHED) {
2633                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2634         } else {
2635                 DO_ASSERT(get_jenv_res == JNI_OK);
2636         }
2637         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2638         CHECK(obj != NULL);
2639         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2640         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2641                 (*env)->ExceptionDescribe(env);
2642                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
2643         }
2644         LDKThirtyTwoBytes ret_ref;
2645         CHECK((*env)->GetArrayLength(env, ret) == 32);
2646         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2647         if (get_jenv_res == JNI_EDETACHED) {
2648                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2649         }
2650         return ret_ref;
2651 }
2652 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2653         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2654         JNIEnv *env;
2655         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2656         if (get_jenv_res == JNI_EDETACHED) {
2657                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2658         } else {
2659                 DO_ASSERT(get_jenv_res == JNI_OK);
2660         }
2661         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2662         int64_t channel_parameters_ref = 0;
2663         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
2664         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2665         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
2666         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2667         CHECK(obj != NULL);
2668         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
2669         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2670                 (*env)->ExceptionDescribe(env);
2671                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
2672         }
2673         if (get_jenv_res == JNI_EDETACHED) {
2674                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2675         }
2676 }
2677 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2678         jclass c = (*env)->GetObjectClass(env, o);
2679         CHECK(c != NULL);
2680         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
2681         atomic_init(&calls->refcnt, 1);
2682         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2683         calls->o = (*env)->NewWeakGlobalRef(env, o);
2684         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2685         CHECK(calls->get_per_commitment_point_meth != NULL);
2686         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2687         CHECK(calls->release_commitment_secret_meth != NULL);
2688         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
2689         CHECK(calls->validate_holder_commitment_meth != NULL);
2690         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2691         CHECK(calls->channel_keys_id_meth != NULL);
2692         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
2693         CHECK(calls->provide_channel_parameters_meth != NULL);
2694
2695         LDKChannelPublicKeys pubkeys_conv;
2696         pubkeys_conv.inner = untag_ptr(pubkeys);
2697         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2698         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2699
2700         LDKChannelSigner ret = {
2701                 .this_arg = (void*) calls,
2702                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
2703                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
2704                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
2705                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
2706                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
2707                 .free = LDKChannelSigner_JCalls_free,
2708                 .pubkeys = pubkeys_conv,
2709                 .set_pubkeys = NULL,
2710         };
2711         return ret;
2712 }
2713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2714         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2715         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
2716         return tag_ptr(res_ptr, true);
2717 }
2718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2719         void* this_arg_ptr = untag_ptr(this_arg);
2720         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2721         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2722         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2723         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2724         return ret_arr;
2725 }
2726
2727 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2728         void* this_arg_ptr = untag_ptr(this_arg);
2729         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2730         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2731         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2732         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2733         return ret_arr;
2734 }
2735
2736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray preimages) {
2737         void* this_arg_ptr = untag_ptr(this_arg);
2738         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2739         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2740         LDKHolderCommitmentTransaction holder_tx_conv;
2741         holder_tx_conv.inner = untag_ptr(holder_tx);
2742         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2743         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2744         holder_tx_conv.is_owned = false;
2745         LDKCVec_ThirtyTwoBytesZ preimages_constr;
2746         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
2747         if (preimages_constr.datalen > 0)
2748                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2749         else
2750                 preimages_constr.data = NULL;
2751         for (size_t i = 0; i < preimages_constr.datalen; i++) {
2752                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
2753                 LDKThirtyTwoBytes preimages_conv_8_ref;
2754                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
2755                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
2756                 preimages_constr.data[i] = preimages_conv_8_ref;
2757         }
2758         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2759         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
2760         return tag_ptr(ret_conv, true);
2761 }
2762
2763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2764         void* this_arg_ptr = untag_ptr(this_arg);
2765         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2766         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2767         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2768         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2769         return ret_arr;
2770 }
2771
2772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2773         void* this_arg_ptr = untag_ptr(this_arg);
2774         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2775         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2776         LDKChannelTransactionParameters channel_parameters_conv;
2777         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2778         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2779         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2780         channel_parameters_conv.is_owned = false;
2781         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2782 }
2783
2784 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2785         if (this_arg->set_pubkeys != NULL)
2786                 this_arg->set_pubkeys(this_arg);
2787         return this_arg->pubkeys;
2788 }
2789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2790         void* this_arg_ptr = untag_ptr(this_arg);
2791         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2792         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2793         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2794         int64_t ret_ref = 0;
2795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2797         return ret_ref;
2798 }
2799
2800 typedef struct LDKEcdsaChannelSigner_JCalls {
2801         atomic_size_t refcnt;
2802         JavaVM *vm;
2803         jweak o;
2804         LDKChannelSigner_JCalls* ChannelSigner;
2805         jmethodID sign_counterparty_commitment_meth;
2806         jmethodID validate_counterparty_revocation_meth;
2807         jmethodID sign_holder_commitment_and_htlcs_meth;
2808         jmethodID sign_justice_revoked_output_meth;
2809         jmethodID sign_justice_revoked_htlc_meth;
2810         jmethodID sign_holder_htlc_transaction_meth;
2811         jmethodID sign_counterparty_htlc_transaction_meth;
2812         jmethodID sign_closing_transaction_meth;
2813         jmethodID sign_holder_anchor_input_meth;
2814         jmethodID sign_channel_announcement_with_funding_key_meth;
2815 } LDKEcdsaChannelSigner_JCalls;
2816 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2817         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2818         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2819                 JNIEnv *env;
2820                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2821                 if (get_jenv_res == JNI_EDETACHED) {
2822                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2823                 } else {
2824                         DO_ASSERT(get_jenv_res == JNI_OK);
2825                 }
2826                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2827                 if (get_jenv_res == JNI_EDETACHED) {
2828                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2829                 }
2830                 FREE(j_calls);
2831         }
2832 }
2833 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
2834         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2835         JNIEnv *env;
2836         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2837         if (get_jenv_res == JNI_EDETACHED) {
2838                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2839         } else {
2840                 DO_ASSERT(get_jenv_res == JNI_OK);
2841         }
2842         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2843         int64_t commitment_tx_ref = 0;
2844         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2845         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2846         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2847         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
2848         jobjectArray preimages_arr = NULL;
2849         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2850         ;
2851         for (size_t i = 0; i < preimages_var.datalen; i++) {
2852                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2853                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2854                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2855         }
2856         
2857         FREE(preimages_var.data);
2858         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2859         CHECK(obj != NULL);
2860         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
2861         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2862                 (*env)->ExceptionDescribe(env);
2863                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2864         }
2865         void* ret_ptr = untag_ptr(ret);
2866         CHECK_ACCESS(ret_ptr);
2867         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2868         FREE(untag_ptr(ret));
2869         if (get_jenv_res == JNI_EDETACHED) {
2870                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2871         }
2872         return ret_conv;
2873 }
2874 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2875         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2876         JNIEnv *env;
2877         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2878         if (get_jenv_res == JNI_EDETACHED) {
2879                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2880         } else {
2881                 DO_ASSERT(get_jenv_res == JNI_OK);
2882         }
2883         int64_t idx_conv = idx;
2884         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2885         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2886         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2887         CHECK(obj != NULL);
2888         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
2889         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2890                 (*env)->ExceptionDescribe(env);
2891                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKEcdsaChannelSigner from rust threw an exception.");
2892         }
2893         void* ret_ptr = untag_ptr(ret);
2894         CHECK_ACCESS(ret_ptr);
2895         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2896         FREE(untag_ptr(ret));
2897         if (get_jenv_res == JNI_EDETACHED) {
2898                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2899         }
2900         return ret_conv;
2901 }
2902 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2903         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2904         JNIEnv *env;
2905         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2906         if (get_jenv_res == JNI_EDETACHED) {
2907                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2908         } else {
2909                 DO_ASSERT(get_jenv_res == JNI_OK);
2910         }
2911         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2912         int64_t commitment_tx_ref = 0;
2913         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2914         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2915         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2916         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2917         CHECK(obj != NULL);
2918         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2919         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2920                 (*env)->ExceptionDescribe(env);
2921                 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKEcdsaChannelSigner from rust threw an exception.");
2922         }
2923         void* ret_ptr = untag_ptr(ret);
2924         CHECK_ACCESS(ret_ptr);
2925         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2926         FREE(untag_ptr(ret));
2927         if (get_jenv_res == JNI_EDETACHED) {
2928                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2929         }
2930         return ret_conv;
2931 }
2932 LDKCResult_ECDSASignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
2933         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2934         JNIEnv *env;
2935         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2936         if (get_jenv_res == JNI_EDETACHED) {
2937                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2938         } else {
2939                 DO_ASSERT(get_jenv_res == JNI_OK);
2940         }
2941         LDKTransaction justice_tx_var = justice_tx;
2942         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2943         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2944         Transaction_free(justice_tx_var);
2945         int64_t input_conv = input;
2946         int64_t amount_conv = amount;
2947         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2948         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2949         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2950         CHECK(obj != NULL);
2951         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr);
2952         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2953                 (*env)->ExceptionDescribe(env);
2954                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
2955         }
2956         void* ret_ptr = untag_ptr(ret);
2957         CHECK_ACCESS(ret_ptr);
2958         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2959         FREE(untag_ptr(ret));
2960         if (get_jenv_res == JNI_EDETACHED) {
2961                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2962         }
2963         return ret_conv;
2964 }
2965 LDKCResult_ECDSASignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2966         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2967         JNIEnv *env;
2968         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2969         if (get_jenv_res == JNI_EDETACHED) {
2970                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2971         } else {
2972                 DO_ASSERT(get_jenv_res == JNI_OK);
2973         }
2974         LDKTransaction justice_tx_var = justice_tx;
2975         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2976         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2977         Transaction_free(justice_tx_var);
2978         int64_t input_conv = input;
2979         int64_t amount_conv = amount;
2980         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2981         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2982         LDKHTLCOutputInCommitment htlc_var = *htlc;
2983         int64_t htlc_ref = 0;
2984         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2985         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2986         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2987         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2988         CHECK(obj != NULL);
2989         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr, htlc_ref);
2990         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2991                 (*env)->ExceptionDescribe(env);
2992                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
2993         }
2994         void* ret_ptr = untag_ptr(ret);
2995         CHECK_ACCESS(ret_ptr);
2996         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2997         FREE(untag_ptr(ret));
2998         if (get_jenv_res == JNI_EDETACHED) {
2999                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3000         }
3001         return ret_conv;
3002 }
3003 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
3004         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3005         JNIEnv *env;
3006         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3007         if (get_jenv_res == JNI_EDETACHED) {
3008                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3009         } else {
3010                 DO_ASSERT(get_jenv_res == JNI_OK);
3011         }
3012         LDKTransaction htlc_tx_var = htlc_tx;
3013         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3014         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3015         Transaction_free(htlc_tx_var);
3016         int64_t input_conv = input;
3017         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
3018         int64_t htlc_descriptor_ref = 0;
3019         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
3020         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
3021         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
3022         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3023         CHECK(obj != NULL);
3024         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
3025         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3026                 (*env)->ExceptionDescribe(env);
3027                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3028         }
3029         void* ret_ptr = untag_ptr(ret);
3030         CHECK_ACCESS(ret_ptr);
3031         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3032         FREE(untag_ptr(ret));
3033         if (get_jenv_res == JNI_EDETACHED) {
3034                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3035         }
3036         return ret_conv;
3037 }
3038 LDKCResult_ECDSASignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
3039         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3040         JNIEnv *env;
3041         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3042         if (get_jenv_res == JNI_EDETACHED) {
3043                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3044         } else {
3045                 DO_ASSERT(get_jenv_res == JNI_OK);
3046         }
3047         LDKTransaction htlc_tx_var = htlc_tx;
3048         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3049         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3050         Transaction_free(htlc_tx_var);
3051         int64_t input_conv = input;
3052         int64_t amount_conv = amount;
3053         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3054         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3055         LDKHTLCOutputInCommitment htlc_var = *htlc;
3056         int64_t htlc_ref = 0;
3057         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3058         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3059         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3060         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3061         CHECK(obj != NULL);
3062         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input_conv, amount_conv, per_commitment_point_arr, htlc_ref);
3063         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3064                 (*env)->ExceptionDescribe(env);
3065                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3066         }
3067         void* ret_ptr = untag_ptr(ret);
3068         CHECK_ACCESS(ret_ptr);
3069         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3070         FREE(untag_ptr(ret));
3071         if (get_jenv_res == JNI_EDETACHED) {
3072                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3073         }
3074         return ret_conv;
3075 }
3076 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3077         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3078         JNIEnv *env;
3079         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3080         if (get_jenv_res == JNI_EDETACHED) {
3081                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3082         } else {
3083                 DO_ASSERT(get_jenv_res == JNI_OK);
3084         }
3085         LDKClosingTransaction closing_tx_var = *closing_tx;
3086         int64_t closing_tx_ref = 0;
3087         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3088         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3089         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3090         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3091         CHECK(obj != NULL);
3092         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3093         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3094                 (*env)->ExceptionDescribe(env);
3095                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3096         }
3097         void* ret_ptr = untag_ptr(ret);
3098         CHECK_ACCESS(ret_ptr);
3099         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3100         FREE(untag_ptr(ret));
3101         if (get_jenv_res == JNI_EDETACHED) {
3102                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3103         }
3104         return ret_conv;
3105 }
3106 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3107         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3108         JNIEnv *env;
3109         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3110         if (get_jenv_res == JNI_EDETACHED) {
3111                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3112         } else {
3113                 DO_ASSERT(get_jenv_res == JNI_OK);
3114         }
3115         LDKTransaction anchor_tx_var = anchor_tx;
3116         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
3117         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
3118         Transaction_free(anchor_tx_var);
3119         int64_t input_conv = input;
3120         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3121         CHECK(obj != NULL);
3122         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
3123         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3124                 (*env)->ExceptionDescribe(env);
3125                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
3126         }
3127         void* ret_ptr = untag_ptr(ret);
3128         CHECK_ACCESS(ret_ptr);
3129         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3130         FREE(untag_ptr(ret));
3131         if (get_jenv_res == JNI_EDETACHED) {
3132                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3133         }
3134         return ret_conv;
3135 }
3136 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3137         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3138         JNIEnv *env;
3139         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3140         if (get_jenv_res == JNI_EDETACHED) {
3141                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3142         } else {
3143                 DO_ASSERT(get_jenv_res == JNI_OK);
3144         }
3145         LDKUnsignedChannelAnnouncement msg_var = *msg;
3146         int64_t msg_ref = 0;
3147         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3148         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3149         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3150         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3151         CHECK(obj != NULL);
3152         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
3153         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3154                 (*env)->ExceptionDescribe(env);
3155                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
3156         }
3157         void* ret_ptr = untag_ptr(ret);
3158         CHECK_ACCESS(ret_ptr);
3159         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3160         FREE(untag_ptr(ret));
3161         if (get_jenv_res == JNI_EDETACHED) {
3162                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3163         }
3164         return ret_conv;
3165 }
3166 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
3167         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3168         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3169         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
3170 }
3171 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3172         jclass c = (*env)->GetObjectClass(env, o);
3173         CHECK(c != NULL);
3174         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
3175         atomic_init(&calls->refcnt, 1);
3176         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3177         calls->o = (*env)->NewWeakGlobalRef(env, o);
3178         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
3179         CHECK(calls->sign_counterparty_commitment_meth != NULL);
3180         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
3181         CHECK(calls->validate_counterparty_revocation_meth != NULL);
3182         calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
3183         CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
3184         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3185         CHECK(calls->sign_justice_revoked_output_meth != NULL);
3186         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3187         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3188         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
3189         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
3190         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3191         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3192         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3193         CHECK(calls->sign_closing_transaction_meth != NULL);
3194         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
3195         CHECK(calls->sign_holder_anchor_input_meth != NULL);
3196         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
3197         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
3198
3199         LDKChannelPublicKeys pubkeys_conv;
3200         pubkeys_conv.inner = untag_ptr(pubkeys);
3201         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3202         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3203
3204         LDKEcdsaChannelSigner ret = {
3205                 .this_arg = (void*) calls,
3206                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
3207                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
3208                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
3209                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
3210                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
3211                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3212                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3213                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
3214                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
3215                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
3216                 .free = LDKEcdsaChannelSigner_JCalls_free,
3217                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
3218         };
3219         calls->ChannelSigner = ret.ChannelSigner.this_arg;
3220         return ret;
3221 }
3222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3223         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
3224         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
3225         return tag_ptr(res_ptr, true);
3226 }
3227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3228         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
3229         return tag_ptr(&inp->ChannelSigner, false);
3230 }
3231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray preimages) {
3232         void* this_arg_ptr = untag_ptr(this_arg);
3233         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3234         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3235         LDKCommitmentTransaction commitment_tx_conv;
3236         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3237         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3238         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3239         commitment_tx_conv.is_owned = false;
3240         LDKCVec_ThirtyTwoBytesZ preimages_constr;
3241         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
3242         if (preimages_constr.datalen > 0)
3243                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3244         else
3245                 preimages_constr.data = NULL;
3246         for (size_t i = 0; i < preimages_constr.datalen; i++) {
3247                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
3248                 LDKThirtyTwoBytes preimages_conv_8_ref;
3249                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
3250                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
3251                 preimages_constr.data[i] = preimages_conv_8_ref;
3252         }
3253         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3254         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3255         return tag_ptr(ret_conv, true);
3256 }
3257
3258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
3259         void* this_arg_ptr = untag_ptr(this_arg);
3260         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3261         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3262         uint8_t secret_arr[32];
3263         CHECK((*env)->GetArrayLength(env, secret) == 32);
3264         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3265         uint8_t (*secret_ref)[32] = &secret_arr;
3266         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3267         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3268         return tag_ptr(ret_conv, true);
3269 }
3270
3271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
3272         void* this_arg_ptr = untag_ptr(this_arg);
3273         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3274         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3275         LDKHolderCommitmentTransaction commitment_tx_conv;
3276         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3277         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3278         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3279         commitment_tx_conv.is_owned = false;
3280         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3281         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3282         return tag_ptr(ret_conv, true);
3283 }
3284
3285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
3286         void* this_arg_ptr = untag_ptr(this_arg);
3287         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3288         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3289         LDKTransaction justice_tx_ref;
3290         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3291         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3292         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3293         justice_tx_ref.data_is_owned = true;
3294         uint8_t per_commitment_key_arr[32];
3295         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3296         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3297         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3298         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3299         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3300         return tag_ptr(ret_conv, true);
3301 }
3302
3303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1htlc(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) {
3304         void* this_arg_ptr = untag_ptr(this_arg);
3305         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3306         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3307         LDKTransaction justice_tx_ref;
3308         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3309         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3310         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3311         justice_tx_ref.data_is_owned = true;
3312         uint8_t per_commitment_key_arr[32];
3313         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3314         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3315         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3316         LDKHTLCOutputInCommitment htlc_conv;
3317         htlc_conv.inner = untag_ptr(htlc);
3318         htlc_conv.is_owned = ptr_is_owned(htlc);
3319         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3320         htlc_conv.is_owned = false;
3321         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3322         *ret_conv = (this_arg_conv->sign_justice_revoked_htlc)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
3323         return tag_ptr(ret_conv, true);
3324 }
3325
3326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t htlc_descriptor) {
3327         void* this_arg_ptr = untag_ptr(this_arg);
3328         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3329         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3330         LDKTransaction htlc_tx_ref;
3331         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3332         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3333         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3334         htlc_tx_ref.data_is_owned = true;
3335         LDKHTLCDescriptor htlc_descriptor_conv;
3336         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3337         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3338         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3339         htlc_descriptor_conv.is_owned = false;
3340         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3341         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3342         return tag_ptr(ret_conv, true);
3343 }
3344
3345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_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) {
3346         void* this_arg_ptr = untag_ptr(this_arg);
3347         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3348         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3349         LDKTransaction htlc_tx_ref;
3350         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3351         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3352         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3353         htlc_tx_ref.data_is_owned = true;
3354         LDKPublicKey per_commitment_point_ref;
3355         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3356         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3357         LDKHTLCOutputInCommitment htlc_conv;
3358         htlc_conv.inner = untag_ptr(htlc);
3359         htlc_conv.is_owned = ptr_is_owned(htlc);
3360         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3361         htlc_conv.is_owned = false;
3362         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3363         *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);
3364         return tag_ptr(ret_conv, true);
3365 }
3366
3367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
3368         void* this_arg_ptr = untag_ptr(this_arg);
3369         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3370         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3371         LDKClosingTransaction closing_tx_conv;
3372         closing_tx_conv.inner = untag_ptr(closing_tx);
3373         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3374         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3375         closing_tx_conv.is_owned = false;
3376         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3377         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3378         return tag_ptr(ret_conv, true);
3379 }
3380
3381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1anchor_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray anchor_tx, int64_t input) {
3382         void* this_arg_ptr = untag_ptr(this_arg);
3383         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3384         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3385         LDKTransaction anchor_tx_ref;
3386         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3387         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3388         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3389         anchor_tx_ref.data_is_owned = true;
3390         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3391         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3392         return tag_ptr(ret_conv, true);
3393 }
3394
3395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1channel_1announcement_1with_1funding_1key(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
3396         void* this_arg_ptr = untag_ptr(this_arg);
3397         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3398         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3399         LDKUnsignedChannelAnnouncement msg_conv;
3400         msg_conv.inner = untag_ptr(msg);
3401         msg_conv.is_owned = ptr_is_owned(msg);
3402         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3403         msg_conv.is_owned = false;
3404         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3405         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3406         return tag_ptr(ret_conv, true);
3407 }
3408
3409 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3410         atomic_size_t refcnt;
3411         JavaVM *vm;
3412         jweak o;
3413         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3414         LDKChannelSigner_JCalls* ChannelSigner;
3415         jmethodID write_meth;
3416 } LDKWriteableEcdsaChannelSigner_JCalls;
3417 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3418         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3419         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3420                 JNIEnv *env;
3421                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3422                 if (get_jenv_res == JNI_EDETACHED) {
3423                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3424                 } else {
3425                         DO_ASSERT(get_jenv_res == JNI_OK);
3426                 }
3427                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3428                 if (get_jenv_res == JNI_EDETACHED) {
3429                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3430                 }
3431                 FREE(j_calls);
3432         }
3433 }
3434 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3435         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3436         JNIEnv *env;
3437         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3438         if (get_jenv_res == JNI_EDETACHED) {
3439                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3440         } else {
3441                 DO_ASSERT(get_jenv_res == JNI_OK);
3442         }
3443         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3444         CHECK(obj != NULL);
3445         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3446         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3447                 (*env)->ExceptionDescribe(env);
3448                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3449         }
3450         LDKCVec_u8Z ret_ref;
3451         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3452         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3453         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3454         if (get_jenv_res == JNI_EDETACHED) {
3455                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3456         }
3457         return ret_ref;
3458 }
3459 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3460         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3461         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3462         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3463         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3464 }
3465 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3466         jclass c = (*env)->GetObjectClass(env, o);
3467         CHECK(c != NULL);
3468         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3469         atomic_init(&calls->refcnt, 1);
3470         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3471         calls->o = (*env)->NewWeakGlobalRef(env, o);
3472         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3473         CHECK(calls->write_meth != NULL);
3474
3475         LDKChannelPublicKeys pubkeys_conv;
3476         pubkeys_conv.inner = untag_ptr(pubkeys);
3477         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3478         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3479
3480         LDKWriteableEcdsaChannelSigner ret = {
3481                 .this_arg = (void*) calls,
3482                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3483                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3484                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3485                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3486         };
3487         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3488         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3489         return ret;
3490 }
3491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3492         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3493         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3494         return tag_ptr(res_ptr, true);
3495 }
3496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3497         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3498         return tag_ptr(&inp->EcdsaChannelSigner, false);
3499 }
3500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3501         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3502         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3503 }
3504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3505         void* this_arg_ptr = untag_ptr(this_arg);
3506         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3507         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3508         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3509         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3510         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3511         CVec_u8Z_free(ret_var);
3512         return ret_arr;
3513 }
3514
3515 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3516 CHECK(owner->result_ok);
3517         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3518 }
3519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3520         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3521         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3522         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3523         return tag_ptr(ret_ret, true);
3524 }
3525
3526 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3527 CHECK(!owner->result_ok);
3528         return DecodeError_clone(&*owner->contents.err);
3529 }
3530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3531         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3532         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3533         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3534         int64_t ret_ref = tag_ptr(ret_copy, true);
3535         return ret_ref;
3536 }
3537
3538 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3539 CHECK(owner->result_ok);
3540         return CVec_u8Z_clone(&*owner->contents.result);
3541 }
3542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3543         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3544         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
3545         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3546         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3547         CVec_u8Z_free(ret_var);
3548         return ret_arr;
3549 }
3550
3551 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3552 CHECK(!owner->result_ok);
3553         return *owner->contents.err;
3554 }
3555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3556         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3557         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
3558 }
3559
3560 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3561         LDKShutdownScript ret = *owner->contents.result;
3562         ret.is_owned = false;
3563         return ret;
3564 }
3565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3566         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3567         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3568         int64_t ret_ref = 0;
3569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3571         return ret_ref;
3572 }
3573
3574 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3575 CHECK(!owner->result_ok);
3576         return *owner->contents.err;
3577 }
3578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3579         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3580         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
3581 }
3582
3583 static jclass LDKCOption_u16Z_Some_class = NULL;
3584 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3585 static jclass LDKCOption_u16Z_None_class = NULL;
3586 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3588         LDKCOption_u16Z_Some_class =
3589                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
3590         CHECK(LDKCOption_u16Z_Some_class != NULL);
3591         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3592         CHECK(LDKCOption_u16Z_Some_meth != NULL);
3593         LDKCOption_u16Z_None_class =
3594                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
3595         CHECK(LDKCOption_u16Z_None_class != NULL);
3596         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3597         CHECK(LDKCOption_u16Z_None_meth != NULL);
3598 }
3599 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3600         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
3601         switch(obj->tag) {
3602                 case LDKCOption_u16Z_Some: {
3603                         int16_t some_conv = obj->some;
3604                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
3605                 }
3606                 case LDKCOption_u16Z_None: {
3607                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3608                 }
3609                 default: abort();
3610         }
3611 }
3612 static jclass LDKCOption_boolZ_Some_class = NULL;
3613 static jmethodID LDKCOption_boolZ_Some_meth = NULL;
3614 static jclass LDKCOption_boolZ_None_class = NULL;
3615 static jmethodID LDKCOption_boolZ_None_meth = NULL;
3616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init (JNIEnv *env, jclass clz) {
3617         LDKCOption_boolZ_Some_class =
3618                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$Some"));
3619         CHECK(LDKCOption_boolZ_Some_class != NULL);
3620         LDKCOption_boolZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_Some_class, "<init>", "(Z)V");
3621         CHECK(LDKCOption_boolZ_Some_meth != NULL);
3622         LDKCOption_boolZ_None_class =
3623                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$None"));
3624         CHECK(LDKCOption_boolZ_None_class != NULL);
3625         LDKCOption_boolZ_None_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_None_class, "<init>", "()V");
3626         CHECK(LDKCOption_boolZ_None_meth != NULL);
3627 }
3628 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1boolZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3629         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
3630         switch(obj->tag) {
3631                 case LDKCOption_boolZ_Some: {
3632                         jboolean some_conv = obj->some;
3633                         return (*env)->NewObject(env, LDKCOption_boolZ_Some_class, LDKCOption_boolZ_Some_meth, some_conv);
3634                 }
3635                 case LDKCOption_boolZ_None: {
3636                         return (*env)->NewObject(env, LDKCOption_boolZ_None_class, LDKCOption_boolZ_None_meth);
3637                 }
3638                 default: abort();
3639         }
3640 }
3641 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3642         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3643         for (size_t i = 0; i < ret.datalen; i++) {
3644                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3645         }
3646         return ret;
3647 }
3648 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3649 CHECK(owner->result_ok);
3650         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
3651 }
3652 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3653         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3654         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
3655         jobjectArray ret_arr = NULL;
3656         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3657         ;
3658         for (size_t i = 0; i < ret_var.datalen; i++) {
3659                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
3660                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
3661                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
3662                 CVec_u8Z_free(ret_conv_8_var);
3663                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3664         }
3665         
3666         FREE(ret_var.data);
3667         return ret_arr;
3668 }
3669
3670 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3671 CHECK(!owner->result_ok);
3672         return *owner->contents.err;
3673 }
3674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3675         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3676         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
3677 }
3678
3679 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3680         LDKInMemorySigner ret = *owner->contents.result;
3681         ret.is_owned = false;
3682         return ret;
3683 }
3684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3685         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3686         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3687         int64_t ret_ref = 0;
3688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3690         return ret_ref;
3691 }
3692
3693 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3694 CHECK(!owner->result_ok);
3695         return DecodeError_clone(&*owner->contents.err);
3696 }
3697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3698         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3699         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3700         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3701         int64_t ret_ref = tag_ptr(ret_copy, true);
3702         return ret_ref;
3703 }
3704
3705 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3706 CHECK(owner->result_ok);
3707         return *owner->contents.result;
3708 }
3709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3710         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3711         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3712         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3713         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3714         return ret_arr;
3715 }
3716
3717 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3718 CHECK(!owner->result_ok);
3719         return *owner->contents.err;
3720 }
3721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3722         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3723         CResult_TransactionNoneZ_get_err(owner_conv);
3724 }
3725
3726 typedef struct LDKScoreLookUp_JCalls {
3727         atomic_size_t refcnt;
3728         JavaVM *vm;
3729         jweak o;
3730         jmethodID channel_penalty_msat_meth;
3731 } LDKScoreLookUp_JCalls;
3732 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
3733         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3734         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3735                 JNIEnv *env;
3736                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3737                 if (get_jenv_res == JNI_EDETACHED) {
3738                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3739                 } else {
3740                         DO_ASSERT(get_jenv_res == JNI_OK);
3741                 }
3742                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3743                 if (get_jenv_res == JNI_EDETACHED) {
3744                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3745                 }
3746                 FREE(j_calls);
3747         }
3748 }
3749 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
3750         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3751         JNIEnv *env;
3752         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3753         if (get_jenv_res == JNI_EDETACHED) {
3754                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3755         } else {
3756                 DO_ASSERT(get_jenv_res == JNI_OK);
3757         }
3758         int64_t short_channel_id_conv = short_channel_id;
3759         LDKNodeId source_var = *source;
3760         int64_t source_ref = 0;
3761         source_var = NodeId_clone(&source_var);
3762         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
3763         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
3764         LDKNodeId target_var = *target;
3765         int64_t target_ref = 0;
3766         target_var = NodeId_clone(&target_var);
3767         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
3768         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
3769         LDKChannelUsage usage_var = usage;
3770         int64_t usage_ref = 0;
3771         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
3772         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
3773         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
3774         int64_t score_params_ref = 0;
3775         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
3776         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
3777         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
3778         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3779         CHECK(obj != NULL);
3780         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref);
3781         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3782                 (*env)->ExceptionDescribe(env);
3783                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScoreLookUp from rust threw an exception.");
3784         }
3785         if (get_jenv_res == JNI_EDETACHED) {
3786                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3787         }
3788         return ret;
3789 }
3790 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
3791         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
3792         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3793 }
3794 static inline LDKScoreLookUp LDKScoreLookUp_init (JNIEnv *env, jclass clz, jobject o) {
3795         jclass c = (*env)->GetObjectClass(env, o);
3796         CHECK(c != NULL);
3797         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
3798         atomic_init(&calls->refcnt, 1);
3799         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3800         calls->o = (*env)->NewWeakGlobalRef(env, o);
3801         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
3802         CHECK(calls->channel_penalty_msat_meth != NULL);
3803
3804         LDKScoreLookUp ret = {
3805                 .this_arg = (void*) calls,
3806                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
3807                 .free = LDKScoreLookUp_JCalls_free,
3808         };
3809         return ret;
3810 }
3811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
3812         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
3813         *res_ptr = LDKScoreLookUp_init(env, clz, o);
3814         return tag_ptr(res_ptr, true);
3815 }
3816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t source, int64_t target, int64_t usage, int64_t score_params) {
3817         void* this_arg_ptr = untag_ptr(this_arg);
3818         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3819         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
3820         LDKNodeId source_conv;
3821         source_conv.inner = untag_ptr(source);
3822         source_conv.is_owned = ptr_is_owned(source);
3823         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
3824         source_conv.is_owned = false;
3825         LDKNodeId target_conv;
3826         target_conv.inner = untag_ptr(target);
3827         target_conv.is_owned = ptr_is_owned(target);
3828         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
3829         target_conv.is_owned = false;
3830         LDKChannelUsage usage_conv;
3831         usage_conv.inner = untag_ptr(usage);
3832         usage_conv.is_owned = ptr_is_owned(usage);
3833         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
3834         usage_conv = ChannelUsage_clone(&usage_conv);
3835         LDKProbabilisticScoringFeeParameters score_params_conv;
3836         score_params_conv.inner = untag_ptr(score_params);
3837         score_params_conv.is_owned = ptr_is_owned(score_params);
3838         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
3839         score_params_conv.is_owned = false;
3840         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv, &score_params_conv);
3841         return ret_conv;
3842 }
3843
3844 typedef struct LDKScoreUpdate_JCalls {
3845         atomic_size_t refcnt;
3846         JavaVM *vm;
3847         jweak o;
3848         jmethodID payment_path_failed_meth;
3849         jmethodID payment_path_successful_meth;
3850         jmethodID probe_failed_meth;
3851         jmethodID probe_successful_meth;
3852 } LDKScoreUpdate_JCalls;
3853 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
3854         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3855         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3856                 JNIEnv *env;
3857                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3858                 if (get_jenv_res == JNI_EDETACHED) {
3859                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3860                 } else {
3861                         DO_ASSERT(get_jenv_res == JNI_OK);
3862                 }
3863                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3864                 if (get_jenv_res == JNI_EDETACHED) {
3865                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3866                 }
3867                 FREE(j_calls);
3868         }
3869 }
3870 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3871         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3872         JNIEnv *env;
3873         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3874         if (get_jenv_res == JNI_EDETACHED) {
3875                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3876         } else {
3877                 DO_ASSERT(get_jenv_res == JNI_OK);
3878         }
3879         LDKPath path_var = *path;
3880         int64_t path_ref = 0;
3881         path_var = Path_clone(&path_var);
3882         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3883         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3884         int64_t short_channel_id_conv = short_channel_id;
3885         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3886         CHECK(obj != NULL);
3887         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv);
3888         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3889                 (*env)->ExceptionDescribe(env);
3890                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScoreUpdate from rust threw an exception.");
3891         }
3892         if (get_jenv_res == JNI_EDETACHED) {
3893                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3894         }
3895 }
3896 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
3897         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3898         JNIEnv *env;
3899         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3900         if (get_jenv_res == JNI_EDETACHED) {
3901                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3902         } else {
3903                 DO_ASSERT(get_jenv_res == JNI_OK);
3904         }
3905         LDKPath path_var = *path;
3906         int64_t path_ref = 0;
3907         path_var = Path_clone(&path_var);
3908         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3909         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3910         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3911         CHECK(obj != NULL);
3912         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref);
3913         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3914                 (*env)->ExceptionDescribe(env);
3915                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScoreUpdate from rust threw an exception.");
3916         }
3917         if (get_jenv_res == JNI_EDETACHED) {
3918                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3919         }
3920 }
3921 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3922         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3923         JNIEnv *env;
3924         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3925         if (get_jenv_res == JNI_EDETACHED) {
3926                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3927         } else {
3928                 DO_ASSERT(get_jenv_res == JNI_OK);
3929         }
3930         LDKPath path_var = *path;
3931         int64_t path_ref = 0;
3932         path_var = Path_clone(&path_var);
3933         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3934         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3935         int64_t short_channel_id_conv = short_channel_id;
3936         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3937         CHECK(obj != NULL);
3938         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv);
3939         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3940                 (*env)->ExceptionDescribe(env);
3941                 (*env)->FatalError(env, "A call to probe_failed in LDKScoreUpdate from rust threw an exception.");
3942         }
3943         if (get_jenv_res == JNI_EDETACHED) {
3944                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3945         }
3946 }
3947 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
3948         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3949         JNIEnv *env;
3950         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3951         if (get_jenv_res == JNI_EDETACHED) {
3952                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3953         } else {
3954                 DO_ASSERT(get_jenv_res == JNI_OK);
3955         }
3956         LDKPath path_var = *path;
3957         int64_t path_ref = 0;
3958         path_var = Path_clone(&path_var);
3959         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3960         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3961         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3962         CHECK(obj != NULL);
3963         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref);
3964         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3965                 (*env)->ExceptionDescribe(env);
3966                 (*env)->FatalError(env, "A call to probe_successful in LDKScoreUpdate from rust threw an exception.");
3967         }
3968         if (get_jenv_res == JNI_EDETACHED) {
3969                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3970         }
3971 }
3972 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
3973         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
3974         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3975 }
3976 static inline LDKScoreUpdate LDKScoreUpdate_init (JNIEnv *env, jclass clz, jobject o) {
3977         jclass c = (*env)->GetObjectClass(env, o);
3978         CHECK(c != NULL);
3979         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_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->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJ)V");
3984         CHECK(calls->payment_path_failed_meth != NULL);
3985         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(J)V");
3986         CHECK(calls->payment_path_successful_meth != NULL);
3987         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJ)V");
3988         CHECK(calls->probe_failed_meth != NULL);
3989         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(J)V");
3990         CHECK(calls->probe_successful_meth != NULL);
3991
3992         LDKScoreUpdate ret = {
3993                 .this_arg = (void*) calls,
3994                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
3995                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
3996                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
3997                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
3998                 .free = LDKScoreUpdate_JCalls_free,
3999         };
4000         return ret;
4001 }
4002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreUpdate_1new(JNIEnv *env, jclass clz, jobject o) {
4003         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4004         *res_ptr = LDKScoreUpdate_init(env, clz, o);
4005         return tag_ptr(res_ptr, true);
4006 }
4007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t short_channel_id) {
4008         void* this_arg_ptr = untag_ptr(this_arg);
4009         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4010         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4011         LDKPath path_conv;
4012         path_conv.inner = untag_ptr(path);
4013         path_conv.is_owned = ptr_is_owned(path);
4014         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4015         path_conv.is_owned = false;
4016         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
4017 }
4018
4019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
4020         void* this_arg_ptr = untag_ptr(this_arg);
4021         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4022         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4023         LDKPath path_conv;
4024         path_conv.inner = untag_ptr(path);
4025         path_conv.is_owned = ptr_is_owned(path);
4026         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4027         path_conv.is_owned = false;
4028         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
4029 }
4030
4031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t short_channel_id) {
4032         void* this_arg_ptr = untag_ptr(this_arg);
4033         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4034         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4035         LDKPath path_conv;
4036         path_conv.inner = untag_ptr(path);
4037         path_conv.is_owned = ptr_is_owned(path);
4038         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4039         path_conv.is_owned = false;
4040         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
4041 }
4042
4043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
4044         void* this_arg_ptr = untag_ptr(this_arg);
4045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4046         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4047         LDKPath path_conv;
4048         path_conv.inner = untag_ptr(path);
4049         path_conv.is_owned = ptr_is_owned(path);
4050         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4051         path_conv.is_owned = false;
4052         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
4053 }
4054
4055 typedef struct LDKLockableScore_JCalls {
4056         atomic_size_t refcnt;
4057         JavaVM *vm;
4058         jweak o;
4059         jmethodID read_lock_meth;
4060         jmethodID write_lock_meth;
4061 } LDKLockableScore_JCalls;
4062 static void LDKLockableScore_JCalls_free(void* this_arg) {
4063         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4064         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4065                 JNIEnv *env;
4066                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4067                 if (get_jenv_res == JNI_EDETACHED) {
4068                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4069                 } else {
4070                         DO_ASSERT(get_jenv_res == JNI_OK);
4071                 }
4072                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4073                 if (get_jenv_res == JNI_EDETACHED) {
4074                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4075                 }
4076                 FREE(j_calls);
4077         }
4078 }
4079 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
4080         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4081         JNIEnv *env;
4082         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4083         if (get_jenv_res == JNI_EDETACHED) {
4084                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4085         } else {
4086                 DO_ASSERT(get_jenv_res == JNI_OK);
4087         }
4088         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4089         CHECK(obj != NULL);
4090         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_lock_meth);
4091         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4092                 (*env)->ExceptionDescribe(env);
4093                 (*env)->FatalError(env, "A call to read_lock in LDKLockableScore from rust threw an exception.");
4094         }
4095         void* ret_ptr = untag_ptr(ret);
4096         CHECK_ACCESS(ret_ptr);
4097         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
4098         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
4099                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4100                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
4101         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
4102         
4103         if (get_jenv_res == JNI_EDETACHED) {
4104                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4105         }
4106         return ret_conv;
4107 }
4108 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
4109         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4110         JNIEnv *env;
4111         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4112         if (get_jenv_res == JNI_EDETACHED) {
4113                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4114         } else {
4115                 DO_ASSERT(get_jenv_res == JNI_OK);
4116         }
4117         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4118         CHECK(obj != NULL);
4119         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_lock_meth);
4120         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4121                 (*env)->ExceptionDescribe(env);
4122                 (*env)->FatalError(env, "A call to write_lock in LDKLockableScore from rust threw an exception.");
4123         }
4124         void* ret_ptr = untag_ptr(ret);
4125         CHECK_ACCESS(ret_ptr);
4126         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
4127         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
4128                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4129                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
4130         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
4131         
4132         if (get_jenv_res == JNI_EDETACHED) {
4133                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4134         }
4135         return ret_conv;
4136 }
4137 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
4138         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
4139         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4140 }
4141 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
4142         jclass c = (*env)->GetObjectClass(env, o);
4143         CHECK(c != NULL);
4144         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
4145         atomic_init(&calls->refcnt, 1);
4146         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4147         calls->o = (*env)->NewWeakGlobalRef(env, o);
4148         calls->read_lock_meth = (*env)->GetMethodID(env, c, "read_lock", "()J");
4149         CHECK(calls->read_lock_meth != NULL);
4150         calls->write_lock_meth = (*env)->GetMethodID(env, c, "write_lock", "()J");
4151         CHECK(calls->write_lock_meth != NULL);
4152
4153         LDKLockableScore ret = {
4154                 .this_arg = (void*) calls,
4155                 .read_lock = read_lock_LDKLockableScore_jcall,
4156                 .write_lock = write_lock_LDKLockableScore_jcall,
4157                 .free = LDKLockableScore_JCalls_free,
4158         };
4159         return ret;
4160 }
4161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
4162         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
4163         *res_ptr = LDKLockableScore_init(env, clz, o);
4164         return tag_ptr(res_ptr, true);
4165 }
4166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1read_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4167         void* this_arg_ptr = untag_ptr(this_arg);
4168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4169         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4170         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4171         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
4172         return tag_ptr(ret_ret, true);
4173 }
4174
4175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1write_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4176         void* this_arg_ptr = untag_ptr(this_arg);
4177         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4178         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4179         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4180         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
4181         return tag_ptr(ret_ret, true);
4182 }
4183
4184 typedef struct LDKWriteableScore_JCalls {
4185         atomic_size_t refcnt;
4186         JavaVM *vm;
4187         jweak o;
4188         LDKLockableScore_JCalls* LockableScore;
4189         jmethodID write_meth;
4190 } LDKWriteableScore_JCalls;
4191 static void LDKWriteableScore_JCalls_free(void* this_arg) {
4192         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4193         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4194                 JNIEnv *env;
4195                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4196                 if (get_jenv_res == JNI_EDETACHED) {
4197                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4198                 } else {
4199                         DO_ASSERT(get_jenv_res == JNI_OK);
4200                 }
4201                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4202                 if (get_jenv_res == JNI_EDETACHED) {
4203                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4204                 }
4205                 FREE(j_calls);
4206         }
4207 }
4208 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
4209         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4210         JNIEnv *env;
4211         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4212         if (get_jenv_res == JNI_EDETACHED) {
4213                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4214         } else {
4215                 DO_ASSERT(get_jenv_res == JNI_OK);
4216         }
4217         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4218         CHECK(obj != NULL);
4219         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4220         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4221                 (*env)->ExceptionDescribe(env);
4222                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
4223         }
4224         LDKCVec_u8Z ret_ref;
4225         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4226         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4227         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4228         if (get_jenv_res == JNI_EDETACHED) {
4229                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4230         }
4231         return ret_ref;
4232 }
4233 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
4234         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
4235         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4236         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
4237 }
4238 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4239         jclass c = (*env)->GetObjectClass(env, o);
4240         CHECK(c != NULL);
4241         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
4242         atomic_init(&calls->refcnt, 1);
4243         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4244         calls->o = (*env)->NewWeakGlobalRef(env, o);
4245         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4246         CHECK(calls->write_meth != NULL);
4247
4248         LDKWriteableScore ret = {
4249                 .this_arg = (void*) calls,
4250                 .write = write_LDKWriteableScore_jcall,
4251                 .free = LDKWriteableScore_JCalls_free,
4252                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
4253         };
4254         calls->LockableScore = ret.LockableScore.this_arg;
4255         return ret;
4256 }
4257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4258         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4259         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
4260         return tag_ptr(res_ptr, true);
4261 }
4262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
4263         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
4264         return tag_ptr(&inp->LockableScore, false);
4265 }
4266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4267         void* this_arg_ptr = untag_ptr(this_arg);
4268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4269         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
4270         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4271         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4272         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4273         CVec_u8Z_free(ret_var);
4274         return ret_arr;
4275 }
4276
4277 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
4278 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
4279 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
4280 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
4281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
4282         LDKCOption_WriteableScoreZ_Some_class =
4283                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
4284         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
4285         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
4286         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
4287         LDKCOption_WriteableScoreZ_None_class =
4288                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
4289         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
4290         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
4291         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
4292 }
4293 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4294         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
4295         switch(obj->tag) {
4296                 case LDKCOption_WriteableScoreZ_Some: {
4297                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4298                         *some_ret = obj->some;
4299                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4300                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
4301                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4302                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
4303                         }
4304                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
4305                 }
4306                 case LDKCOption_WriteableScoreZ_None: {
4307                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
4308                 }
4309                 default: abort();
4310         }
4311 }
4312 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4313 CHECK(owner->result_ok);
4314         return *owner->contents.result;
4315 }
4316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4317         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4318         CResult_NoneIOErrorZ_get_ok(owner_conv);
4319 }
4320
4321 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4322 CHECK(!owner->result_ok);
4323         return *owner->contents.err;
4324 }
4325 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4326         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4327         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneIOErrorZ_get_err(owner_conv));
4328         return ret_conv;
4329 }
4330
4331 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
4332         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4333         for (size_t i = 0; i < ret.datalen; i++) {
4334                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4335         }
4336         return ret;
4337 }
4338 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4339         LDKRoute ret = *owner->contents.result;
4340         ret.is_owned = false;
4341         return ret;
4342 }
4343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4344         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4345         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4346         int64_t ret_ref = 0;
4347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4349         return ret_ref;
4350 }
4351
4352 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4353         LDKLightningError ret = *owner->contents.err;
4354         ret.is_owned = false;
4355         return ret;
4356 }
4357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4358         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4359         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4360         int64_t ret_ref = 0;
4361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4363         return ret_ref;
4364 }
4365
4366 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4367         LDKInFlightHtlcs ret = *owner->contents.result;
4368         ret.is_owned = false;
4369         return ret;
4370 }
4371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4372         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4373         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4374         int64_t ret_ref = 0;
4375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4377         return ret_ref;
4378 }
4379
4380 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4381 CHECK(!owner->result_ok);
4382         return DecodeError_clone(&*owner->contents.err);
4383 }
4384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4385         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4386         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4387         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4388         int64_t ret_ref = tag_ptr(ret_copy, true);
4389         return ret_ref;
4390 }
4391
4392 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4393         LDKRouteHop ret = *owner->contents.result;
4394         ret.is_owned = false;
4395         return ret;
4396 }
4397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4398         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4399         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4400         int64_t ret_ref = 0;
4401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4403         return ret_ref;
4404 }
4405
4406 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4407 CHECK(!owner->result_ok);
4408         return DecodeError_clone(&*owner->contents.err);
4409 }
4410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4411         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4412         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4413         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
4414         int64_t ret_ref = tag_ptr(ret_copy, true);
4415         return ret_ref;
4416 }
4417
4418 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
4419         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
4420         for (size_t i = 0; i < ret.datalen; i++) {
4421                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
4422         }
4423         return ret;
4424 }
4425 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4426         LDKBlindedTail ret = *owner->contents.result;
4427         ret.is_owned = false;
4428         return ret;
4429 }
4430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4431         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4432         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
4433         int64_t ret_ref = 0;
4434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4436         return ret_ref;
4437 }
4438
4439 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4440 CHECK(!owner->result_ok);
4441         return DecodeError_clone(&*owner->contents.err);
4442 }
4443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4444         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4445         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4446         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
4447         int64_t ret_ref = tag_ptr(ret_copy, true);
4448         return ret_ref;
4449 }
4450
4451 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
4452         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
4453         for (size_t i = 0; i < ret.datalen; i++) {
4454                 ret.data[i] = RouteHop_clone(&orig->data[i]);
4455         }
4456         return ret;
4457 }
4458 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
4459         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
4460         for (size_t i = 0; i < ret.datalen; i++) {
4461                 ret.data[i] = Path_clone(&orig->data[i]);
4462         }
4463         return ret;
4464 }
4465 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4466         LDKRoute ret = *owner->contents.result;
4467         ret.is_owned = false;
4468         return ret;
4469 }
4470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4471         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4472         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
4473         int64_t ret_ref = 0;
4474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4476         return ret_ref;
4477 }
4478
4479 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4480 CHECK(!owner->result_ok);
4481         return DecodeError_clone(&*owner->contents.err);
4482 }
4483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4484         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4485         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4486         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
4487         int64_t ret_ref = tag_ptr(ret_copy, true);
4488         return ret_ref;
4489 }
4490
4491 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4492         LDKRouteParameters ret = *owner->contents.result;
4493         ret.is_owned = false;
4494         return ret;
4495 }
4496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4497         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4498         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
4499         int64_t ret_ref = 0;
4500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4502         return ret_ref;
4503 }
4504
4505 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4506 CHECK(!owner->result_ok);
4507         return DecodeError_clone(&*owner->contents.err);
4508 }
4509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4510         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4511         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4512         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
4513         int64_t ret_ref = tag_ptr(ret_copy, true);
4514         return ret_ref;
4515 }
4516
4517 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4518         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4519         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4520         return ret;
4521 }
4522 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4523         LDKPaymentParameters ret = *owner->contents.result;
4524         ret.is_owned = false;
4525         return ret;
4526 }
4527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4528         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4529         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
4530         int64_t ret_ref = 0;
4531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4533         return ret_ref;
4534 }
4535
4536 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4537 CHECK(!owner->result_ok);
4538         return DecodeError_clone(&*owner->contents.err);
4539 }
4540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4541         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4542         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4543         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
4544         int64_t ret_ref = tag_ptr(ret_copy, true);
4545         return ret_ref;
4546 }
4547
4548 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4549         LDKBlindedPayInfo ret = owner->a;
4550         ret.is_owned = false;
4551         return ret;
4552 }
4553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4554         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4555         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4556         int64_t ret_ref = 0;
4557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4559         return ret_ref;
4560 }
4561
4562 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4563         LDKBlindedPath ret = owner->b;
4564         ret.is_owned = false;
4565         return ret;
4566 }
4567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4568         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4569         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4570         int64_t ret_ref = 0;
4571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4573         return ret_ref;
4574 }
4575
4576 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4577         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4578         for (size_t i = 0; i < ret.datalen; i++) {
4579                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4580         }
4581         return ret;
4582 }
4583 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
4584         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
4585         for (size_t i = 0; i < ret.datalen; i++) {
4586                 ret.data[i] = RouteHint_clone(&orig->data[i]);
4587         }
4588         return ret;
4589 }
4590 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
4591         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
4592         for (size_t i = 0; i < ret.datalen; i++) {
4593                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
4594         }
4595         return ret;
4596 }
4597 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4598         LDKRouteHint ret = *owner->contents.result;
4599         ret.is_owned = false;
4600         return ret;
4601 }
4602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4603         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4604         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
4605         int64_t ret_ref = 0;
4606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4608         return ret_ref;
4609 }
4610
4611 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4612 CHECK(!owner->result_ok);
4613         return DecodeError_clone(&*owner->contents.err);
4614 }
4615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4616         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4617         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4618         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
4619         int64_t ret_ref = tag_ptr(ret_copy, true);
4620         return ret_ref;
4621 }
4622
4623 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4624         LDKRouteHintHop ret = *owner->contents.result;
4625         ret.is_owned = false;
4626         return ret;
4627 }
4628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4629         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4630         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
4631         int64_t ret_ref = 0;
4632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4634         return ret_ref;
4635 }
4636
4637 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4638 CHECK(!owner->result_ok);
4639         return DecodeError_clone(&*owner->contents.err);
4640 }
4641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4642         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4643         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4644         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
4645         int64_t ret_ref = tag_ptr(ret_copy, true);
4646         return ret_ref;
4647 }
4648
4649 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4650         LDKFixedPenaltyScorer ret = *owner->contents.result;
4651         ret.is_owned = false;
4652         return ret;
4653 }
4654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4655         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4656         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
4657         int64_t ret_ref = 0;
4658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4660         return ret_ref;
4661 }
4662
4663 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4664 CHECK(!owner->result_ok);
4665         return DecodeError_clone(&*owner->contents.err);
4666 }
4667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4668         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4669         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4670         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
4671         int64_t ret_ref = tag_ptr(ret_copy, true);
4672         return ret_ref;
4673 }
4674
4675 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4676         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4677         for (size_t i = 0; i < ret.datalen; i++) {
4678                 ret.data[i] = NodeId_clone(&orig->data[i]);
4679         }
4680         return ret;
4681 }
4682 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4683         return owner->a;
4684 }
4685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4686         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4687         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
4688         return ret_conv;
4689 }
4690
4691 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4692         return owner->b;
4693 }
4694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4695         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4696         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
4697         return ret_conv;
4698 }
4699
4700 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
4701 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
4702 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
4703 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
4704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
4705         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4706                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4707         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4708         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4709         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4710         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4711                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4712         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4713         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4714         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4715 }
4716 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4717         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4718         switch(obj->tag) {
4719                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4720                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4721                         *some_conv = obj->some;
4722                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4723                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4724                 }
4725                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4726                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4727                 }
4728                 default: abort();
4729         }
4730 }
4731 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
4732         return owner->a;
4733 }
4734 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4735         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4736         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4737         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_a(owner_conv).data);
4738         return ret_arr;
4739 }
4740
4741 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
4742         return owner->b;
4743 }
4744 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4745         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4746         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4747         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_b(owner_conv).data);
4748         return ret_arr;
4749 }
4750
4751 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4752         return owner->a;
4753 }
4754 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4755         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4756         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4757         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_a(owner_conv).data);
4758         return ret_arr;
4759 }
4760
4761 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4762         return owner->b;
4763 }
4764 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4765         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4766         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4767         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_b(owner_conv).data);
4768         return ret_arr;
4769 }
4770
4771 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class = NULL;
4772 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = NULL;
4773 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class = NULL;
4774 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = NULL;
4775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_init (JNIEnv *env, jclass clz) {
4776         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class =
4777                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$Some"));
4778         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class != NULL);
4779         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, "<init>", "(J)V");
4780         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth != NULL);
4781         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class =
4782                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$None"));
4783         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class != NULL);
4784         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, "<init>", "()V");
4785         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth != NULL);
4786 }
4787 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4788         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
4789         switch(obj->tag) {
4790                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: {
4791                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
4792                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
4793                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth, tag_ptr(some_conv, false));
4794                 }
4795                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: {
4796                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth);
4797                 }
4798                 default: abort();
4799         }
4800 }
4801 static jclass LDKCOption_f64Z_Some_class = NULL;
4802 static jmethodID LDKCOption_f64Z_Some_meth = NULL;
4803 static jclass LDKCOption_f64Z_None_class = NULL;
4804 static jmethodID LDKCOption_f64Z_None_meth = NULL;
4805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1f64Z_init (JNIEnv *env, jclass clz) {
4806         LDKCOption_f64Z_Some_class =
4807                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$Some"));
4808         CHECK(LDKCOption_f64Z_Some_class != NULL);
4809         LDKCOption_f64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_Some_class, "<init>", "(D)V");
4810         CHECK(LDKCOption_f64Z_Some_meth != NULL);
4811         LDKCOption_f64Z_None_class =
4812                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$None"));
4813         CHECK(LDKCOption_f64Z_None_class != NULL);
4814         LDKCOption_f64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_None_class, "<init>", "()V");
4815         CHECK(LDKCOption_f64Z_None_meth != NULL);
4816 }
4817 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1f64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4818         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
4819         switch(obj->tag) {
4820                 case LDKCOption_f64Z_Some: {
4821                         double some_conv = obj->some;
4822                         return (*env)->NewObject(env, LDKCOption_f64Z_Some_class, LDKCOption_f64Z_Some_meth, some_conv);
4823                 }
4824                 case LDKCOption_f64Z_None: {
4825                         return (*env)->NewObject(env, LDKCOption_f64Z_None_class, LDKCOption_f64Z_None_meth);
4826                 }
4827                 default: abort();
4828         }
4829 }
4830 typedef struct LDKLogger_JCalls {
4831         atomic_size_t refcnt;
4832         JavaVM *vm;
4833         jweak o;
4834         jmethodID log_meth;
4835 } LDKLogger_JCalls;
4836 static void LDKLogger_JCalls_free(void* this_arg) {
4837         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4838         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4839                 JNIEnv *env;
4840                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4841                 if (get_jenv_res == JNI_EDETACHED) {
4842                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4843                 } else {
4844                         DO_ASSERT(get_jenv_res == JNI_OK);
4845                 }
4846                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4847                 if (get_jenv_res == JNI_EDETACHED) {
4848                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4849                 }
4850                 FREE(j_calls);
4851         }
4852 }
4853 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4854         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4855         JNIEnv *env;
4856         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4857         if (get_jenv_res == JNI_EDETACHED) {
4858                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4859         } else {
4860                 DO_ASSERT(get_jenv_res == JNI_OK);
4861         }
4862         LDKRecord record_var = *record;
4863         int64_t record_ref = 0;
4864         record_var = Record_clone(&record_var);
4865         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4866         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
4867         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4868         CHECK(obj != NULL);
4869         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
4870         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4871                 (*env)->ExceptionDescribe(env);
4872                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4873         }
4874         if (get_jenv_res == JNI_EDETACHED) {
4875                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4876         }
4877 }
4878 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4879         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4880         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4881 }
4882 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4883         jclass c = (*env)->GetObjectClass(env, o);
4884         CHECK(c != NULL);
4885         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4886         atomic_init(&calls->refcnt, 1);
4887         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4888         calls->o = (*env)->NewWeakGlobalRef(env, o);
4889         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
4890         CHECK(calls->log_meth != NULL);
4891
4892         LDKLogger ret = {
4893                 .this_arg = (void*) calls,
4894                 .log = log_LDKLogger_jcall,
4895                 .free = LDKLogger_JCalls_free,
4896         };
4897         return ret;
4898 }
4899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4900         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4901         *res_ptr = LDKLogger_init(env, clz, o);
4902         return tag_ptr(res_ptr, true);
4903 }
4904 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4905         LDKProbabilisticScorer ret = *owner->contents.result;
4906         ret.is_owned = false;
4907         return ret;
4908 }
4909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4910         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4911         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
4912         int64_t ret_ref = 0;
4913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4915         return ret_ref;
4916 }
4917
4918 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4919 CHECK(!owner->result_ok);
4920         return DecodeError_clone(&*owner->contents.err);
4921 }
4922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4923         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4924         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4925         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
4926         int64_t ret_ref = tag_ptr(ret_copy, true);
4927         return ret_ref;
4928 }
4929
4930 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4931         return owner->a;
4932 }
4933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4934         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4935         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
4936         return ret_conv;
4937 }
4938
4939 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4940         return owner->b;
4941 }
4942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4943         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4944         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
4945         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4946         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4947         return ret_arr;
4948 }
4949
4950 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
4951         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
4952         for (size_t i = 0; i < ret.datalen; i++) {
4953                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
4954         }
4955         return ret;
4956 }
4957 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
4958         return ThirtyTwoBytes_clone(&owner->a);
4959 }
4960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4961         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
4962         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4963         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(owner_conv).data);
4964         return ret_arr;
4965 }
4966
4967 static inline struct LDKCOption_ThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
4968         return COption_ThirtyTwoBytesZ_clone(&owner->b);
4969 }
4970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4971         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
4972         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
4973         *ret_copy = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(owner_conv);
4974         int64_t ret_ref = tag_ptr(ret_copy, true);
4975         return ret_ref;
4976 }
4977
4978 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ *orig) {
4979         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
4980         for (size_t i = 0; i < ret.datalen; i++) {
4981                 ret.data[i] = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
4982         }
4983         return ret;
4984 }
4985 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
4986 CHECK(owner->result_ok);
4987         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
4988 }
4989 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4990         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
4991         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
4992         return ret_conv;
4993 }
4994
4995 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
4996 CHECK(!owner->result_ok);
4997         return *owner->contents.err;
4998 }
4999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5000         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5001         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
5002 }
5003
5004 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
5005 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
5006 static jclass LDKMonitorEvent_HolderForceClosed_class = NULL;
5007 static jmethodID LDKMonitorEvent_HolderForceClosed_meth = NULL;
5008 static jclass LDKMonitorEvent_Completed_class = NULL;
5009 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
5010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
5011         LDKMonitorEvent_HTLCEvent_class =
5012                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
5013         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
5014         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
5015         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
5016         LDKMonitorEvent_HolderForceClosed_class =
5017                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosed"));
5018         CHECK(LDKMonitorEvent_HolderForceClosed_class != NULL);
5019         LDKMonitorEvent_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosed_class, "<init>", "(J)V");
5020         CHECK(LDKMonitorEvent_HolderForceClosed_meth != NULL);
5021         LDKMonitorEvent_Completed_class =
5022                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
5023         CHECK(LDKMonitorEvent_Completed_class != NULL);
5024         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJ)V");
5025         CHECK(LDKMonitorEvent_Completed_meth != NULL);
5026 }
5027 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5028         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
5029         switch(obj->tag) {
5030                 case LDKMonitorEvent_HTLCEvent: {
5031                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
5032                         int64_t htlc_event_ref = 0;
5033                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
5034                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
5035                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
5036                 }
5037                 case LDKMonitorEvent_HolderForceClosed: {
5038                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
5039                         int64_t holder_force_closed_ref = 0;
5040                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
5041                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
5042                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosed_class, LDKMonitorEvent_HolderForceClosed_meth, holder_force_closed_ref);
5043                 }
5044                 case LDKMonitorEvent_Completed: {
5045                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
5046                         int64_t funding_txo_ref = 0;
5047                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5048                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
5049                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
5050                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, monitor_update_id_conv);
5051                 }
5052                 default: abort();
5053         }
5054 }
5055 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
5056         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
5057         for (size_t i = 0; i < ret.datalen; i++) {
5058                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
5059         }
5060         return ret;
5061 }
5062 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5063         LDKOutPoint ret = owner->a;
5064         ret.is_owned = false;
5065         return ret;
5066 }
5067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5068         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5069         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
5070         int64_t ret_ref = 0;
5071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5073         return ret_ref;
5074 }
5075
5076 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5077         return CVec_MonitorEventZ_clone(&owner->b);
5078 }
5079 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5080         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5081         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
5082         int64_tArray ret_arr = NULL;
5083         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5084         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5085         for (size_t o = 0; o < ret_var.datalen; o++) {
5086                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5087                 *ret_conv_14_copy = ret_var.data[o];
5088                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
5089                 ret_arr_ptr[o] = ret_conv_14_ref;
5090         }
5091         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5092         FREE(ret_var.data);
5093         return ret_arr;
5094 }
5095
5096 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5097         return owner->c;
5098 }
5099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5100         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5101         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5102         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
5103         return ret_arr;
5104 }
5105
5106 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
5107         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5108         for (size_t i = 0; i < ret.datalen; i++) {
5109                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
5110         }
5111         return ret;
5112 }
5113 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5114         LDKInitFeatures ret = *owner->contents.result;
5115         ret.is_owned = false;
5116         return ret;
5117 }
5118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5119         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5120         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
5121         int64_t ret_ref = 0;
5122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5124         return ret_ref;
5125 }
5126
5127 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5128 CHECK(!owner->result_ok);
5129         return DecodeError_clone(&*owner->contents.err);
5130 }
5131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5132         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5133         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5134         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
5135         int64_t ret_ref = tag_ptr(ret_copy, true);
5136         return ret_ref;
5137 }
5138
5139 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5140         LDKChannelFeatures ret = *owner->contents.result;
5141         ret.is_owned = false;
5142         return ret;
5143 }
5144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5145         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5146         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
5147         int64_t ret_ref = 0;
5148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5150         return ret_ref;
5151 }
5152
5153 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5154 CHECK(!owner->result_ok);
5155         return DecodeError_clone(&*owner->contents.err);
5156 }
5157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5158         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5159         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5160         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
5161         int64_t ret_ref = tag_ptr(ret_copy, true);
5162         return ret_ref;
5163 }
5164
5165 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5166         LDKNodeFeatures ret = *owner->contents.result;
5167         ret.is_owned = false;
5168         return ret;
5169 }
5170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5171         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5172         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
5173         int64_t ret_ref = 0;
5174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5176         return ret_ref;
5177 }
5178
5179 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5180 CHECK(!owner->result_ok);
5181         return DecodeError_clone(&*owner->contents.err);
5182 }
5183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5184         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5185         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5186         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
5187         int64_t ret_ref = tag_ptr(ret_copy, true);
5188         return ret_ref;
5189 }
5190
5191 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5192         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
5193         ret.is_owned = false;
5194         return ret;
5195 }
5196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5197         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5198         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5199         int64_t ret_ref = 0;
5200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5202         return ret_ref;
5203 }
5204
5205 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5206 CHECK(!owner->result_ok);
5207         return DecodeError_clone(&*owner->contents.err);
5208 }
5209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5210         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5211         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5212         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5213         int64_t ret_ref = tag_ptr(ret_copy, true);
5214         return ret_ref;
5215 }
5216
5217 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5218         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
5219         ret.is_owned = false;
5220         return ret;
5221 }
5222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5223         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5224         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5225         int64_t ret_ref = 0;
5226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5228         return ret_ref;
5229 }
5230
5231 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5232 CHECK(!owner->result_ok);
5233         return DecodeError_clone(&*owner->contents.err);
5234 }
5235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5236         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5237         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5238         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5239         int64_t ret_ref = tag_ptr(ret_copy, true);
5240         return ret_ref;
5241 }
5242
5243 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5244         LDKBlindedHopFeatures ret = *owner->contents.result;
5245         ret.is_owned = false;
5246         return ret;
5247 }
5248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5249         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5250         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
5251         int64_t ret_ref = 0;
5252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5254         return ret_ref;
5255 }
5256
5257 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5258 CHECK(!owner->result_ok);
5259         return DecodeError_clone(&*owner->contents.err);
5260 }
5261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5262         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5263         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5264         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
5265         int64_t ret_ref = tag_ptr(ret_copy, true);
5266         return ret_ref;
5267 }
5268
5269 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5270         LDKChannelTypeFeatures ret = *owner->contents.result;
5271         ret.is_owned = false;
5272         return ret;
5273 }
5274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5275         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5276         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
5277         int64_t ret_ref = 0;
5278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5280         return ret_ref;
5281 }
5282
5283 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5284 CHECK(!owner->result_ok);
5285         return DecodeError_clone(&*owner->contents.err);
5286 }
5287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5288         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5289         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5290         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
5291         int64_t ret_ref = tag_ptr(ret_copy, true);
5292         return ret_ref;
5293 }
5294
5295 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5296         LDKOffer ret = *owner->contents.result;
5297         ret.is_owned = false;
5298         return ret;
5299 }
5300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5301         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5302         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5303         int64_t ret_ref = 0;
5304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5306         return ret_ref;
5307 }
5308
5309 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5310         LDKBolt12ParseError ret = *owner->contents.err;
5311         ret.is_owned = false;
5312         return ret;
5313 }
5314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5315         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5316         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5317         int64_t ret_ref = 0;
5318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5320         return ret_ref;
5321 }
5322
5323 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5324 CHECK(owner->result_ok);
5325         return *owner->contents.result;
5326 }
5327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5328         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5329         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5330         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form);
5331         return ret_arr;
5332 }
5333
5334 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5335 CHECK(!owner->result_ok);
5336         return *owner->contents.err;
5337 }
5338 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5339         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5340         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
5341         return ret_conv;
5342 }
5343
5344 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5345         LDKNodeId ret = *owner->contents.result;
5346         ret.is_owned = false;
5347         return ret;
5348 }
5349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5350         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5351         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5352         int64_t ret_ref = 0;
5353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5355         return ret_ref;
5356 }
5357
5358 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5359 CHECK(!owner->result_ok);
5360         return DecodeError_clone(&*owner->contents.err);
5361 }
5362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5363         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5364         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5365         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5366         int64_t ret_ref = tag_ptr(ret_copy, true);
5367         return ret_ref;
5368 }
5369
5370 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
5371 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
5372 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
5373 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
5374 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
5375 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
5376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
5377         LDKNetworkUpdate_ChannelUpdateMessage_class =
5378                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
5379         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
5380         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
5381         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
5382         LDKNetworkUpdate_ChannelFailure_class =
5383                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
5384         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
5385         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
5386         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
5387         LDKNetworkUpdate_NodeFailure_class =
5388                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
5389         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
5390         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
5391         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
5392 }
5393 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5394         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
5395         switch(obj->tag) {
5396                 case LDKNetworkUpdate_ChannelUpdateMessage: {
5397                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
5398                         int64_t msg_ref = 0;
5399                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5400                         msg_ref = tag_ptr(msg_var.inner, false);
5401                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
5402                 }
5403                 case LDKNetworkUpdate_ChannelFailure: {
5404                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
5405                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
5406                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
5407                 }
5408                 case LDKNetworkUpdate_NodeFailure: {
5409                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5410                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
5411                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
5412                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
5413                 }
5414                 default: abort();
5415         }
5416 }
5417 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
5418 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
5419 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
5420 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
5421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
5422         LDKCOption_NetworkUpdateZ_Some_class =
5423                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
5424         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
5425         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
5426         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
5427         LDKCOption_NetworkUpdateZ_None_class =
5428                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
5429         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
5430         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
5431         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
5432 }
5433 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5434         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
5435         switch(obj->tag) {
5436                 case LDKCOption_NetworkUpdateZ_Some: {
5437                         int64_t some_ref = tag_ptr(&obj->some, false);
5438                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
5439                 }
5440                 case LDKCOption_NetworkUpdateZ_None: {
5441                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
5442                 }
5443                 default: abort();
5444         }
5445 }
5446 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5447 CHECK(owner->result_ok);
5448         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5449 }
5450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5451         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5452         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5453         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5454         int64_t ret_ref = tag_ptr(ret_copy, true);
5455         return ret_ref;
5456 }
5457
5458 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5459 CHECK(!owner->result_ok);
5460         return DecodeError_clone(&*owner->contents.err);
5461 }
5462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5463         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5464         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5465         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5466         int64_t ret_ref = tag_ptr(ret_copy, true);
5467         return ret_ref;
5468 }
5469
5470 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5471 CHECK(owner->result_ok);
5472         return TxOut_clone(&*owner->contents.result);
5473 }
5474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5475         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5476         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5477         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5478         return tag_ptr(ret_ref, true);
5479 }
5480
5481 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5482 CHECK(!owner->result_ok);
5483         return UtxoLookupError_clone(&*owner->contents.err);
5484 }
5485 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5486         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5487         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5488         return ret_conv;
5489 }
5490
5491 static jclass LDKUtxoResult_Sync_class = NULL;
5492 static jmethodID LDKUtxoResult_Sync_meth = NULL;
5493 static jclass LDKUtxoResult_Async_class = NULL;
5494 static jmethodID LDKUtxoResult_Async_meth = NULL;
5495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
5496         LDKUtxoResult_Sync_class =
5497                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
5498         CHECK(LDKUtxoResult_Sync_class != NULL);
5499         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
5500         CHECK(LDKUtxoResult_Sync_meth != NULL);
5501         LDKUtxoResult_Async_class =
5502                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
5503         CHECK(LDKUtxoResult_Async_class != NULL);
5504         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
5505         CHECK(LDKUtxoResult_Async_meth != NULL);
5506 }
5507 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5508         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5509         switch(obj->tag) {
5510                 case LDKUtxoResult_Sync: {
5511                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5512                         *sync_conv = obj->sync;
5513                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5514                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
5515                 }
5516                 case LDKUtxoResult_Async: {
5517                         LDKUtxoFuture async_var = obj->async;
5518                         int64_t async_ref = 0;
5519                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5520                         async_ref = tag_ptr(async_var.inner, false);
5521                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
5522                 }
5523                 default: abort();
5524         }
5525 }
5526 typedef struct LDKUtxoLookup_JCalls {
5527         atomic_size_t refcnt;
5528         JavaVM *vm;
5529         jweak o;
5530         jmethodID get_utxo_meth;
5531 } LDKUtxoLookup_JCalls;
5532 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5533         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5534         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5535                 JNIEnv *env;
5536                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5537                 if (get_jenv_res == JNI_EDETACHED) {
5538                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5539                 } else {
5540                         DO_ASSERT(get_jenv_res == JNI_OK);
5541                 }
5542                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5543                 if (get_jenv_res == JNI_EDETACHED) {
5544                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5545                 }
5546                 FREE(j_calls);
5547         }
5548 }
5549 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
5550         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5551         JNIEnv *env;
5552         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5553         if (get_jenv_res == JNI_EDETACHED) {
5554                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5555         } else {
5556                 DO_ASSERT(get_jenv_res == JNI_OK);
5557         }
5558         int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
5559         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
5560         int64_t short_channel_id_conv = short_channel_id;
5561         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5562         CHECK(obj != NULL);
5563         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
5564         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5565                 (*env)->ExceptionDescribe(env);
5566                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
5567         }
5568         void* ret_ptr = untag_ptr(ret);
5569         CHECK_ACCESS(ret_ptr);
5570         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5571         FREE(untag_ptr(ret));
5572         if (get_jenv_res == JNI_EDETACHED) {
5573                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5574         }
5575         return ret_conv;
5576 }
5577 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5578         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5579         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5580 }
5581 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
5582         jclass c = (*env)->GetObjectClass(env, o);
5583         CHECK(c != NULL);
5584         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5585         atomic_init(&calls->refcnt, 1);
5586         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5587         calls->o = (*env)->NewWeakGlobalRef(env, o);
5588         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5589         CHECK(calls->get_utxo_meth != NULL);
5590
5591         LDKUtxoLookup ret = {
5592                 .this_arg = (void*) calls,
5593                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5594                 .free = LDKUtxoLookup_JCalls_free,
5595         };
5596         return ret;
5597 }
5598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
5599         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5600         *res_ptr = LDKUtxoLookup_init(env, clz, o);
5601         return tag_ptr(res_ptr, true);
5602 }
5603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
5604         void* this_arg_ptr = untag_ptr(this_arg);
5605         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5606         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5607         uint8_t genesis_hash_arr[32];
5608         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
5609         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
5610         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
5611         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5612         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
5613         int64_t ret_ref = tag_ptr(ret_copy, true);
5614         return ret_ref;
5615 }
5616
5617 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
5618 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
5619 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
5620 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
5621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
5622         LDKCOption_UtxoLookupZ_Some_class =
5623                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
5624         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
5625         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
5626         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
5627         LDKCOption_UtxoLookupZ_None_class =
5628                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
5629         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
5630         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
5631         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
5632 }
5633 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5634         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5635         switch(obj->tag) {
5636                 case LDKCOption_UtxoLookupZ_Some: {
5637                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5638                         *some_ret = obj->some;
5639                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5640                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5641                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5642                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5643                         }
5644                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
5645                 }
5646                 case LDKCOption_UtxoLookupZ_None: {
5647                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
5648                 }
5649                 default: abort();
5650         }
5651 }
5652 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5653 CHECK(owner->result_ok);
5654         return *owner->contents.result;
5655 }
5656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5657         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5658         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5659 }
5660
5661 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5662         LDKLightningError ret = *owner->contents.err;
5663         ret.is_owned = false;
5664         return ret;
5665 }
5666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5667         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5668         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5669         int64_t ret_ref = 0;
5670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5672         return ret_ref;
5673 }
5674
5675 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5676 CHECK(owner->result_ok);
5677         return *owner->contents.result;
5678 }
5679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5680         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5681         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5682         return ret_conv;
5683 }
5684
5685 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5686         LDKLightningError ret = *owner->contents.err;
5687         ret.is_owned = false;
5688         return ret;
5689 }
5690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5691         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5692         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5693         int64_t ret_ref = 0;
5694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5696         return ret_ref;
5697 }
5698
5699 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5700         LDKChannelAnnouncement ret = owner->a;
5701         ret.is_owned = false;
5702         return ret;
5703 }
5704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5705         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5706         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5707         int64_t ret_ref = 0;
5708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5710         return ret_ref;
5711 }
5712
5713 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5714         LDKChannelUpdate ret = owner->b;
5715         ret.is_owned = false;
5716         return ret;
5717 }
5718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5719         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5720         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5721         int64_t ret_ref = 0;
5722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5724         return ret_ref;
5725 }
5726
5727 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5728         LDKChannelUpdate ret = owner->c;
5729         ret.is_owned = false;
5730         return ret;
5731 }
5732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5733         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5734         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5735         int64_t ret_ref = 0;
5736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5738         return ret_ref;
5739 }
5740
5741 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
5742 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
5743 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
5744 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
5745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
5746         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
5747                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
5748         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
5749         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
5750         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
5751         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
5752                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
5753         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
5754         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
5755         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
5756 }
5757 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5758         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5759         switch(obj->tag) {
5760                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
5761                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5762                         *some_conv = obj->some;
5763                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
5764                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
5765                 }
5766                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
5767                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
5768                 }
5769                 default: abort();
5770         }
5771 }
5772 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
5773 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
5774 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
5775 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
5776 static jclass LDKErrorAction_IgnoreError_class = NULL;
5777 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
5778 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
5779 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
5780 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
5781 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
5782 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
5783 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
5784 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
5785 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
5786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
5787         LDKErrorAction_DisconnectPeer_class =
5788                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
5789         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
5790         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
5791         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
5792         LDKErrorAction_DisconnectPeerWithWarning_class =
5793                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
5794         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
5795         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
5796         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
5797         LDKErrorAction_IgnoreError_class =
5798                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
5799         CHECK(LDKErrorAction_IgnoreError_class != NULL);
5800         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
5801         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
5802         LDKErrorAction_IgnoreAndLog_class =
5803                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
5804         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
5805         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
5806         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
5807         LDKErrorAction_IgnoreDuplicateGossip_class =
5808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
5809         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
5810         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
5811         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
5812         LDKErrorAction_SendErrorMessage_class =
5813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
5814         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
5815         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
5816         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
5817         LDKErrorAction_SendWarningMessage_class =
5818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
5819         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
5820         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
5821         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
5822 }
5823 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5824         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
5825         switch(obj->tag) {
5826                 case LDKErrorAction_DisconnectPeer: {
5827                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
5828                         int64_t msg_ref = 0;
5829                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5830                         msg_ref = tag_ptr(msg_var.inner, false);
5831                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
5832                 }
5833                 case LDKErrorAction_DisconnectPeerWithWarning: {
5834                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
5835                         int64_t msg_ref = 0;
5836                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5837                         msg_ref = tag_ptr(msg_var.inner, false);
5838                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
5839                 }
5840                 case LDKErrorAction_IgnoreError: {
5841                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
5842                 }
5843                 case LDKErrorAction_IgnoreAndLog: {
5844                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
5845                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
5846                 }
5847                 case LDKErrorAction_IgnoreDuplicateGossip: {
5848                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
5849                 }
5850                 case LDKErrorAction_SendErrorMessage: {
5851                         LDKErrorMessage msg_var = obj->send_error_message.msg;
5852                         int64_t msg_ref = 0;
5853                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5854                         msg_ref = tag_ptr(msg_var.inner, false);
5855                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
5856                 }
5857                 case LDKErrorAction_SendWarningMessage: {
5858                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
5859                         int64_t msg_ref = 0;
5860                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5861                         msg_ref = tag_ptr(msg_var.inner, false);
5862                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
5863                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
5864                 }
5865                 default: abort();
5866         }
5867 }
5868 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
5869 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
5870 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
5871 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
5872 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
5873 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
5874 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
5875 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
5876 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
5877 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
5878 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
5879 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
5880 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
5881 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
5882 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
5883 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
5884 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
5885 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
5886 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
5887 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
5888 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
5889 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
5890 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
5891 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
5892 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
5893 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
5894 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
5895 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
5896 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
5897 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
5898 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
5899 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
5900 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
5901 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
5902 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
5903 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
5904 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
5905 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
5906 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
5907 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
5908 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
5909 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
5910 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
5911 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
5912 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
5913 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
5914 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
5915 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
5916 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
5917 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
5918 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
5919 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
5920 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
5921 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
5922 static jclass LDKMessageSendEvent_HandleError_class = NULL;
5923 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
5924 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
5925 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
5926 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
5927 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
5928 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
5929 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
5930 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
5931 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
5932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
5933         LDKMessageSendEvent_SendAcceptChannel_class =
5934                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
5935         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
5936         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
5937         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
5938         LDKMessageSendEvent_SendAcceptChannelV2_class =
5939                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
5940         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
5941         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
5942         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
5943         LDKMessageSendEvent_SendOpenChannel_class =
5944                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
5945         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
5946         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
5947         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
5948         LDKMessageSendEvent_SendOpenChannelV2_class =
5949                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
5950         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
5951         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
5952         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
5953         LDKMessageSendEvent_SendFundingCreated_class =
5954                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
5955         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
5956         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
5957         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
5958         LDKMessageSendEvent_SendFundingSigned_class =
5959                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
5960         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
5961         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
5962         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
5963         LDKMessageSendEvent_SendTxAddInput_class =
5964                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
5965         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
5966         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
5967         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
5968         LDKMessageSendEvent_SendTxAddOutput_class =
5969                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
5970         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
5971         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
5972         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
5973         LDKMessageSendEvent_SendTxRemoveInput_class =
5974                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
5975         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
5976         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
5977         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
5978         LDKMessageSendEvent_SendTxRemoveOutput_class =
5979                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
5980         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
5981         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
5982         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
5983         LDKMessageSendEvent_SendTxComplete_class =
5984                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
5985         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
5986         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
5987         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
5988         LDKMessageSendEvent_SendTxSignatures_class =
5989                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
5990         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
5991         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
5992         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
5993         LDKMessageSendEvent_SendTxInitRbf_class =
5994                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
5995         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
5996         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
5997         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
5998         LDKMessageSendEvent_SendTxAckRbf_class =
5999                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
6000         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
6001         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
6002         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
6003         LDKMessageSendEvent_SendTxAbort_class =
6004                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
6005         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
6006         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
6007         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
6008         LDKMessageSendEvent_SendChannelReady_class =
6009                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
6010         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
6011         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
6012         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
6013         LDKMessageSendEvent_SendAnnouncementSignatures_class =
6014                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
6015         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
6016         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
6017         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
6018         LDKMessageSendEvent_UpdateHTLCs_class =
6019                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
6020         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
6021         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
6022         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
6023         LDKMessageSendEvent_SendRevokeAndACK_class =
6024                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
6025         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
6026         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
6027         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
6028         LDKMessageSendEvent_SendClosingSigned_class =
6029                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
6030         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
6031         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
6032         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
6033         LDKMessageSendEvent_SendShutdown_class =
6034                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
6035         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
6036         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
6037         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
6038         LDKMessageSendEvent_SendChannelReestablish_class =
6039                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
6040         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
6041         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
6042         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
6043         LDKMessageSendEvent_SendChannelAnnouncement_class =
6044                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
6045         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
6046         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
6047         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
6048         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
6049                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
6050         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
6051         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
6052         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
6053         LDKMessageSendEvent_BroadcastChannelUpdate_class =
6054                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
6055         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
6056         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
6057         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
6058         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
6059                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
6060         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
6061         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
6062         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
6063         LDKMessageSendEvent_SendChannelUpdate_class =
6064                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
6065         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
6066         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
6067         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
6068         LDKMessageSendEvent_HandleError_class =
6069                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
6070         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
6071         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
6072         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
6073         LDKMessageSendEvent_SendChannelRangeQuery_class =
6074                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
6075         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
6076         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
6077         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
6078         LDKMessageSendEvent_SendShortIdsQuery_class =
6079                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
6080         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
6081         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
6082         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
6083         LDKMessageSendEvent_SendReplyChannelRange_class =
6084                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
6085         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
6086         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
6087         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
6088         LDKMessageSendEvent_SendGossipTimestampFilter_class =
6089                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
6090         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
6091         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
6092         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
6093 }
6094 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6095         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
6096         switch(obj->tag) {
6097                 case LDKMessageSendEvent_SendAcceptChannel: {
6098                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6099                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
6100                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
6101                         int64_t msg_ref = 0;
6102                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6103                         msg_ref = tag_ptr(msg_var.inner, false);
6104                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
6105                 }
6106                 case LDKMessageSendEvent_SendAcceptChannelV2: {
6107                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6108                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
6109                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
6110                         int64_t msg_ref = 0;
6111                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6112                         msg_ref = tag_ptr(msg_var.inner, false);
6113                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
6114                 }
6115                 case LDKMessageSendEvent_SendOpenChannel: {
6116                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6117                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
6118                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
6119                         int64_t msg_ref = 0;
6120                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6121                         msg_ref = tag_ptr(msg_var.inner, false);
6122                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
6123                 }
6124                 case LDKMessageSendEvent_SendOpenChannelV2: {
6125                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6126                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
6127                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
6128                         int64_t msg_ref = 0;
6129                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6130                         msg_ref = tag_ptr(msg_var.inner, false);
6131                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
6132                 }
6133                 case LDKMessageSendEvent_SendFundingCreated: {
6134                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6135                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
6136                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
6137                         int64_t msg_ref = 0;
6138                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6139                         msg_ref = tag_ptr(msg_var.inner, false);
6140                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
6141                 }
6142                 case LDKMessageSendEvent_SendFundingSigned: {
6143                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6144                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
6145                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
6146                         int64_t msg_ref = 0;
6147                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6148                         msg_ref = tag_ptr(msg_var.inner, false);
6149                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
6150                 }
6151                 case LDKMessageSendEvent_SendTxAddInput: {
6152                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6153                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
6154                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
6155                         int64_t msg_ref = 0;
6156                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6157                         msg_ref = tag_ptr(msg_var.inner, false);
6158                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
6159                 }
6160                 case LDKMessageSendEvent_SendTxAddOutput: {
6161                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6162                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
6163                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
6164                         int64_t msg_ref = 0;
6165                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6166                         msg_ref = tag_ptr(msg_var.inner, false);
6167                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
6168                 }
6169                 case LDKMessageSendEvent_SendTxRemoveInput: {
6170                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6171                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
6172                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
6173                         int64_t msg_ref = 0;
6174                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6175                         msg_ref = tag_ptr(msg_var.inner, false);
6176                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
6177                 }
6178                 case LDKMessageSendEvent_SendTxRemoveOutput: {
6179                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6180                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
6181                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
6182                         int64_t msg_ref = 0;
6183                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6184                         msg_ref = tag_ptr(msg_var.inner, false);
6185                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
6186                 }
6187                 case LDKMessageSendEvent_SendTxComplete: {
6188                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6189                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
6190                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
6191                         int64_t msg_ref = 0;
6192                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6193                         msg_ref = tag_ptr(msg_var.inner, false);
6194                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
6195                 }
6196                 case LDKMessageSendEvent_SendTxSignatures: {
6197                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6198                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
6199                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
6200                         int64_t msg_ref = 0;
6201                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6202                         msg_ref = tag_ptr(msg_var.inner, false);
6203                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
6204                 }
6205                 case LDKMessageSendEvent_SendTxInitRbf: {
6206                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6207                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
6208                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
6209                         int64_t msg_ref = 0;
6210                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6211                         msg_ref = tag_ptr(msg_var.inner, false);
6212                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
6213                 }
6214                 case LDKMessageSendEvent_SendTxAckRbf: {
6215                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6216                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
6217                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
6218                         int64_t msg_ref = 0;
6219                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6220                         msg_ref = tag_ptr(msg_var.inner, false);
6221                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
6222                 }
6223                 case LDKMessageSendEvent_SendTxAbort: {
6224                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6225                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
6226                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
6227                         int64_t msg_ref = 0;
6228                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6229                         msg_ref = tag_ptr(msg_var.inner, false);
6230                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
6231                 }
6232                 case LDKMessageSendEvent_SendChannelReady: {
6233                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6234                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
6235                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
6236                         int64_t msg_ref = 0;
6237                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6238                         msg_ref = tag_ptr(msg_var.inner, false);
6239                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
6240                 }
6241                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
6242                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6243                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
6244                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
6245                         int64_t msg_ref = 0;
6246                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6247                         msg_ref = tag_ptr(msg_var.inner, false);
6248                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
6249                 }
6250                 case LDKMessageSendEvent_UpdateHTLCs: {
6251                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6252                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
6253                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
6254                         int64_t updates_ref = 0;
6255                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
6256                         updates_ref = tag_ptr(updates_var.inner, false);
6257                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
6258                 }
6259                 case LDKMessageSendEvent_SendRevokeAndACK: {
6260                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6261                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
6262                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
6263                         int64_t msg_ref = 0;
6264                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6265                         msg_ref = tag_ptr(msg_var.inner, false);
6266                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
6267                 }
6268                 case LDKMessageSendEvent_SendClosingSigned: {
6269                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6270                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
6271                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
6272                         int64_t msg_ref = 0;
6273                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6274                         msg_ref = tag_ptr(msg_var.inner, false);
6275                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
6276                 }
6277                 case LDKMessageSendEvent_SendShutdown: {
6278                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6279                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
6280                         LDKShutdown msg_var = obj->send_shutdown.msg;
6281                         int64_t msg_ref = 0;
6282                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6283                         msg_ref = tag_ptr(msg_var.inner, false);
6284                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
6285                 }
6286                 case LDKMessageSendEvent_SendChannelReestablish: {
6287                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6288                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
6289                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
6290                         int64_t msg_ref = 0;
6291                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6292                         msg_ref = tag_ptr(msg_var.inner, false);
6293                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
6294                 }
6295                 case LDKMessageSendEvent_SendChannelAnnouncement: {
6296                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6297                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
6298                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
6299                         int64_t msg_ref = 0;
6300                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6301                         msg_ref = tag_ptr(msg_var.inner, false);
6302                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
6303                         int64_t update_msg_ref = 0;
6304                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6305                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6306                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
6307                 }
6308                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
6309                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
6310                         int64_t msg_ref = 0;
6311                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6312                         msg_ref = tag_ptr(msg_var.inner, false);
6313                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
6314                         int64_t update_msg_ref = 0;
6315                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6316                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6317                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
6318                 }
6319                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
6320                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
6321                         int64_t msg_ref = 0;
6322                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6323                         msg_ref = tag_ptr(msg_var.inner, false);
6324                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
6325                 }
6326                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
6327                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
6328                         int64_t msg_ref = 0;
6329                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6330                         msg_ref = tag_ptr(msg_var.inner, false);
6331                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
6332                 }
6333                 case LDKMessageSendEvent_SendChannelUpdate: {
6334                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6335                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
6336                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
6337                         int64_t msg_ref = 0;
6338                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6339                         msg_ref = tag_ptr(msg_var.inner, false);
6340                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
6341                 }
6342                 case LDKMessageSendEvent_HandleError: {
6343                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6344                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
6345                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
6346                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
6347                 }
6348                 case LDKMessageSendEvent_SendChannelRangeQuery: {
6349                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6350                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
6351                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
6352                         int64_t msg_ref = 0;
6353                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6354                         msg_ref = tag_ptr(msg_var.inner, false);
6355                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
6356                 }
6357                 case LDKMessageSendEvent_SendShortIdsQuery: {
6358                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6359                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
6360                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
6361                         int64_t msg_ref = 0;
6362                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6363                         msg_ref = tag_ptr(msg_var.inner, false);
6364                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
6365                 }
6366                 case LDKMessageSendEvent_SendReplyChannelRange: {
6367                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6368                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
6369                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
6370                         int64_t msg_ref = 0;
6371                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6372                         msg_ref = tag_ptr(msg_var.inner, false);
6373                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
6374                 }
6375                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
6376                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6377                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
6378                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
6379                         int64_t msg_ref = 0;
6380                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6381                         msg_ref = tag_ptr(msg_var.inner, false);
6382                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
6383                 }
6384                 default: abort();
6385         }
6386 }
6387 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
6388         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
6389         for (size_t i = 0; i < ret.datalen; i++) {
6390                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
6391         }
6392         return ret;
6393 }
6394 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6395         LDKChannelUpdateInfo ret = *owner->contents.result;
6396         ret.is_owned = false;
6397         return ret;
6398 }
6399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6400         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6401         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6402         int64_t ret_ref = 0;
6403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6405         return ret_ref;
6406 }
6407
6408 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6409 CHECK(!owner->result_ok);
6410         return DecodeError_clone(&*owner->contents.err);
6411 }
6412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6413         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6414         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6415         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6416         int64_t ret_ref = tag_ptr(ret_copy, true);
6417         return ret_ref;
6418 }
6419
6420 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6421         LDKChannelInfo ret = *owner->contents.result;
6422         ret.is_owned = false;
6423         return ret;
6424 }
6425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6426         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6427         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6428         int64_t ret_ref = 0;
6429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6431         return ret_ref;
6432 }
6433
6434 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6435 CHECK(!owner->result_ok);
6436         return DecodeError_clone(&*owner->contents.err);
6437 }
6438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6439         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6440         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6441         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6442         int64_t ret_ref = tag_ptr(ret_copy, true);
6443         return ret_ref;
6444 }
6445
6446 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6447         LDKRoutingFees ret = *owner->contents.result;
6448         ret.is_owned = false;
6449         return ret;
6450 }
6451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6452         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6453         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6454         int64_t ret_ref = 0;
6455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6457         return ret_ref;
6458 }
6459
6460 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6461 CHECK(!owner->result_ok);
6462         return DecodeError_clone(&*owner->contents.err);
6463 }
6464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6465         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6466         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6467         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6468         int64_t ret_ref = tag_ptr(ret_copy, true);
6469         return ret_ref;
6470 }
6471
6472 static jclass LDKSocketAddress_TcpIpV4_class = NULL;
6473 static jmethodID LDKSocketAddress_TcpIpV4_meth = NULL;
6474 static jclass LDKSocketAddress_TcpIpV6_class = NULL;
6475 static jmethodID LDKSocketAddress_TcpIpV6_meth = NULL;
6476 static jclass LDKSocketAddress_OnionV2_class = NULL;
6477 static jmethodID LDKSocketAddress_OnionV2_meth = NULL;
6478 static jclass LDKSocketAddress_OnionV3_class = NULL;
6479 static jmethodID LDKSocketAddress_OnionV3_meth = NULL;
6480 static jclass LDKSocketAddress_Hostname_class = NULL;
6481 static jmethodID LDKSocketAddress_Hostname_meth = NULL;
6482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSocketAddress_init (JNIEnv *env, jclass clz) {
6483         LDKSocketAddress_TcpIpV4_class =
6484                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV4"));
6485         CHECK(LDKSocketAddress_TcpIpV4_class != NULL);
6486         LDKSocketAddress_TcpIpV4_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV4_class, "<init>", "([BS)V");
6487         CHECK(LDKSocketAddress_TcpIpV4_meth != NULL);
6488         LDKSocketAddress_TcpIpV6_class =
6489                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV6"));
6490         CHECK(LDKSocketAddress_TcpIpV6_class != NULL);
6491         LDKSocketAddress_TcpIpV6_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV6_class, "<init>", "([BS)V");
6492         CHECK(LDKSocketAddress_TcpIpV6_meth != NULL);
6493         LDKSocketAddress_OnionV2_class =
6494                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV2"));
6495         CHECK(LDKSocketAddress_OnionV2_class != NULL);
6496         LDKSocketAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV2_class, "<init>", "([B)V");
6497         CHECK(LDKSocketAddress_OnionV2_meth != NULL);
6498         LDKSocketAddress_OnionV3_class =
6499                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV3"));
6500         CHECK(LDKSocketAddress_OnionV3_class != NULL);
6501         LDKSocketAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV3_class, "<init>", "([BSBS)V");
6502         CHECK(LDKSocketAddress_OnionV3_meth != NULL);
6503         LDKSocketAddress_Hostname_class =
6504                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$Hostname"));
6505         CHECK(LDKSocketAddress_Hostname_class != NULL);
6506         LDKSocketAddress_Hostname_meth = (*env)->GetMethodID(env, LDKSocketAddress_Hostname_class, "<init>", "(JS)V");
6507         CHECK(LDKSocketAddress_Hostname_meth != NULL);
6508 }
6509 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6510         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
6511         switch(obj->tag) {
6512                 case LDKSocketAddress_TcpIpV4: {
6513                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
6514                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->tcp_ip_v4.addr.data);
6515                         int16_t port_conv = obj->tcp_ip_v4.port;
6516                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV4_class, LDKSocketAddress_TcpIpV4_meth, addr_arr, port_conv);
6517                 }
6518                 case LDKSocketAddress_TcpIpV6: {
6519                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
6520                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->tcp_ip_v6.addr.data);
6521                         int16_t port_conv = obj->tcp_ip_v6.port;
6522                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV6_class, LDKSocketAddress_TcpIpV6_meth, addr_arr, port_conv);
6523                 }
6524                 case LDKSocketAddress_OnionV2: {
6525                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
6526                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
6527                         return (*env)->NewObject(env, LDKSocketAddress_OnionV2_class, LDKSocketAddress_OnionV2_meth, onion_v2_arr);
6528                 }
6529                 case LDKSocketAddress_OnionV3: {
6530                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
6531                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
6532                         int16_t checksum_conv = obj->onion_v3.checksum;
6533                         int8_t version_conv = obj->onion_v3.version;
6534                         int16_t port_conv = obj->onion_v3.port;
6535                         return (*env)->NewObject(env, LDKSocketAddress_OnionV3_class, LDKSocketAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
6536                 }
6537                 case LDKSocketAddress_Hostname: {
6538                         LDKHostname hostname_var = obj->hostname.hostname;
6539                         int64_t hostname_ref = 0;
6540                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
6541                         hostname_ref = tag_ptr(hostname_var.inner, false);
6542                         int16_t port_conv = obj->hostname.port;
6543                         return (*env)->NewObject(env, LDKSocketAddress_Hostname_class, LDKSocketAddress_Hostname_meth, hostname_ref, port_conv);
6544                 }
6545                 default: abort();
6546         }
6547 }
6548 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
6549         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
6550         for (size_t i = 0; i < ret.datalen; i++) {
6551                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
6552         }
6553         return ret;
6554 }
6555 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6556         LDKNodeAnnouncementInfo ret = *owner->contents.result;
6557         ret.is_owned = false;
6558         return ret;
6559 }
6560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6561         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6562         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6563         int64_t ret_ref = 0;
6564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6566         return ret_ref;
6567 }
6568
6569 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6570 CHECK(!owner->result_ok);
6571         return DecodeError_clone(&*owner->contents.err);
6572 }
6573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6574         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6575         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6576         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6577         int64_t ret_ref = tag_ptr(ret_copy, true);
6578         return ret_ref;
6579 }
6580
6581 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6582         LDKNodeAlias ret = *owner->contents.result;
6583         ret.is_owned = false;
6584         return ret;
6585 }
6586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6587         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6588         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
6589         int64_t ret_ref = 0;
6590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6592         return ret_ref;
6593 }
6594
6595 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6596 CHECK(!owner->result_ok);
6597         return DecodeError_clone(&*owner->contents.err);
6598 }
6599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6600         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6601         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6602         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
6603         int64_t ret_ref = tag_ptr(ret_copy, true);
6604         return ret_ref;
6605 }
6606
6607 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6608         LDKNodeInfo ret = *owner->contents.result;
6609         ret.is_owned = false;
6610         return ret;
6611 }
6612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6613         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6614         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6615         int64_t ret_ref = 0;
6616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6618         return ret_ref;
6619 }
6620
6621 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6622 CHECK(!owner->result_ok);
6623         return DecodeError_clone(&*owner->contents.err);
6624 }
6625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6626         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6627         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6628         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6629         int64_t ret_ref = tag_ptr(ret_copy, true);
6630         return ret_ref;
6631 }
6632
6633 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6634         LDKNetworkGraph ret = *owner->contents.result;
6635         ret.is_owned = false;
6636         return ret;
6637 }
6638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6639         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6640         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6641         int64_t ret_ref = 0;
6642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6644         return ret_ref;
6645 }
6646
6647 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6648 CHECK(!owner->result_ok);
6649         return DecodeError_clone(&*owner->contents.err);
6650 }
6651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6652         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6653         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6654         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6655         int64_t ret_ref = tag_ptr(ret_copy, true);
6656         return ret_ref;
6657 }
6658
6659 static jclass LDKCOption_CVec_SocketAddressZZ_Some_class = NULL;
6660 static jmethodID LDKCOption_CVec_SocketAddressZZ_Some_meth = NULL;
6661 static jclass LDKCOption_CVec_SocketAddressZZ_None_class = NULL;
6662 static jmethodID LDKCOption_CVec_SocketAddressZZ_None_meth = NULL;
6663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1SocketAddressZZ_init (JNIEnv *env, jclass clz) {
6664         LDKCOption_CVec_SocketAddressZZ_Some_class =
6665                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$Some"));
6666         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_class != NULL);
6667         LDKCOption_CVec_SocketAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_Some_class, "<init>", "([J)V");
6668         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_meth != NULL);
6669         LDKCOption_CVec_SocketAddressZZ_None_class =
6670                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$None"));
6671         CHECK(LDKCOption_CVec_SocketAddressZZ_None_class != NULL);
6672         LDKCOption_CVec_SocketAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_None_class, "<init>", "()V");
6673         CHECK(LDKCOption_CVec_SocketAddressZZ_None_meth != NULL);
6674 }
6675 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6676         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
6677         switch(obj->tag) {
6678                 case LDKCOption_CVec_SocketAddressZZ_Some: {
6679                         LDKCVec_SocketAddressZ some_var = obj->some;
6680                         int64_tArray some_arr = NULL;
6681                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
6682                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6683                         for (size_t p = 0; p < some_var.datalen; p++) {
6684                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
6685                                 some_arr_ptr[p] = some_conv_15_ref;
6686                         }
6687                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6688                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_Some_class, LDKCOption_CVec_SocketAddressZZ_Some_meth, some_arr);
6689                 }
6690                 case LDKCOption_CVec_SocketAddressZZ_None: {
6691                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_None_class, LDKCOption_CVec_SocketAddressZZ_None_meth);
6692                 }
6693                 default: abort();
6694         }
6695 }
6696 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
6697         LDKChannelDerivationParameters ret = *owner->contents.result;
6698         ret.is_owned = false;
6699         return ret;
6700 }
6701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6702         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
6703         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
6704         int64_t ret_ref = 0;
6705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6707         return ret_ref;
6708 }
6709
6710 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
6711 CHECK(!owner->result_ok);
6712         return DecodeError_clone(&*owner->contents.err);
6713 }
6714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6715         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
6716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6717         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
6718         int64_t ret_ref = tag_ptr(ret_copy, true);
6719         return ret_ref;
6720 }
6721
6722 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
6723         LDKHTLCDescriptor ret = *owner->contents.result;
6724         ret.is_owned = false;
6725         return ret;
6726 }
6727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6728         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
6729         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
6730         int64_t ret_ref = 0;
6731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6733         return ret_ref;
6734 }
6735
6736 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
6737 CHECK(!owner->result_ok);
6738         return DecodeError_clone(&*owner->contents.err);
6739 }
6740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6741         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
6742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6743         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
6744         int64_t ret_ref = tag_ptr(ret_copy, true);
6745         return ret_ref;
6746 }
6747
6748 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
6749         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
6750         for (size_t i = 0; i < ret.datalen; i++) {
6751                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
6752         }
6753         return ret;
6754 }
6755 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
6756         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
6757         for (size_t i = 0; i < ret.datalen; i++) {
6758                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
6759         }
6760         return ret;
6761 }
6762 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
6763         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
6764         for (size_t i = 0; i < ret.datalen; i++) {
6765                 ret.data[i] = Utxo_clone(&orig->data[i]);
6766         }
6767         return ret;
6768 }
6769 static jclass LDKCOption_TxOutZ_Some_class = NULL;
6770 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
6771 static jclass LDKCOption_TxOutZ_None_class = NULL;
6772 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
6773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
6774         LDKCOption_TxOutZ_Some_class =
6775                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
6776         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
6777         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
6778         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
6779         LDKCOption_TxOutZ_None_class =
6780                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
6781         CHECK(LDKCOption_TxOutZ_None_class != NULL);
6782         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
6783         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
6784 }
6785 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6786         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
6787         switch(obj->tag) {
6788                 case LDKCOption_TxOutZ_Some: {
6789                         LDKTxOut* some_ref = &obj->some;
6790                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
6791                 }
6792                 case LDKCOption_TxOutZ_None: {
6793                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
6794                 }
6795                 default: abort();
6796         }
6797 }
6798 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
6799         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
6800         for (size_t i = 0; i < ret.datalen; i++) {
6801                 ret.data[i] = Input_clone(&orig->data[i]);
6802         }
6803         return ret;
6804 }
6805 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6806         LDKCoinSelection ret = *owner->contents.result;
6807         ret.is_owned = false;
6808         return ret;
6809 }
6810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6811         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6812         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
6813         int64_t ret_ref = 0;
6814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6816         return ret_ref;
6817 }
6818
6819 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6820 CHECK(!owner->result_ok);
6821         return *owner->contents.err;
6822 }
6823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6824         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6825         CResult_CoinSelectionNoneZ_get_err(owner_conv);
6826 }
6827
6828 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6829 CHECK(owner->result_ok);
6830         return CVec_UtxoZ_clone(&*owner->contents.result);
6831 }
6832 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6833         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6834         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
6835         int64_tArray ret_arr = NULL;
6836         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6837         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6838         for (size_t g = 0; g < ret_var.datalen; g++) {
6839                 LDKUtxo ret_conv_6_var = ret_var.data[g];
6840                 int64_t ret_conv_6_ref = 0;
6841                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
6842                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
6843                 ret_arr_ptr[g] = ret_conv_6_ref;
6844         }
6845         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6846         FREE(ret_var.data);
6847         return ret_arr;
6848 }
6849
6850 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6851 CHECK(!owner->result_ok);
6852         return *owner->contents.err;
6853 }
6854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6855         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6856         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
6857 }
6858
6859 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
6860         return owner->a;
6861 }
6862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6863         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
6864         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
6865         return ret_conv;
6866 }
6867
6868 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
6869         return owner->b;
6870 }
6871 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6872         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
6873         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
6874         return ret_conv;
6875 }
6876
6877 static jclass LDKCOption_C2Tuple_u64u16ZZ_Some_class = NULL;
6878 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_Some_meth = NULL;
6879 static jclass LDKCOption_C2Tuple_u64u16ZZ_None_class = NULL;
6880 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_None_meth = NULL;
6881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u16ZZ_init (JNIEnv *env, jclass clz) {
6882         LDKCOption_C2Tuple_u64u16ZZ_Some_class =
6883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$Some"));
6884         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_class != NULL);
6885         LDKCOption_C2Tuple_u64u16ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, "<init>", "(J)V");
6886         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_meth != NULL);
6887         LDKCOption_C2Tuple_u64u16ZZ_None_class =
6888                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$None"));
6889         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_class != NULL);
6890         LDKCOption_C2Tuple_u64u16ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, "<init>", "()V");
6891         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_meth != NULL);
6892 }
6893 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u16ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6894         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
6895         switch(obj->tag) {
6896                 case LDKCOption_C2Tuple_u64u16ZZ_Some: {
6897                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
6898                         *some_conv = obj->some;
6899                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
6900                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, LDKCOption_C2Tuple_u64u16ZZ_Some_meth, tag_ptr(some_conv, true));
6901                 }
6902                 case LDKCOption_C2Tuple_u64u16ZZ_None: {
6903                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, LDKCOption_C2Tuple_u64u16ZZ_None_meth);
6904                 }
6905                 default: abort();
6906         }
6907 }
6908 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
6909 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
6910 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
6911 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
6912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
6913         LDKCOption_ChannelShutdownStateZ_Some_class =
6914                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
6915         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
6916         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
6917         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
6918         LDKCOption_ChannelShutdownStateZ_None_class =
6919                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
6920         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
6921         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
6922         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
6923 }
6924 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6925         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
6926         switch(obj->tag) {
6927                 case LDKCOption_ChannelShutdownStateZ_Some: {
6928                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
6929                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
6930                 }
6931                 case LDKCOption_ChannelShutdownStateZ_None: {
6932                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
6933                 }
6934                 default: abort();
6935         }
6936 }
6937 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6938 CHECK(owner->result_ok);
6939         return ThirtyTwoBytes_clone(&*owner->contents.result);
6940 }
6941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6942         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6943         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6944         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data);
6945         return ret_arr;
6946 }
6947
6948 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6949 CHECK(!owner->result_ok);
6950         return APIError_clone(&*owner->contents.err);
6951 }
6952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6953         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6954         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6955         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
6956         int64_t ret_ref = tag_ptr(ret_copy, true);
6957         return ret_ref;
6958 }
6959
6960 static jclass LDKRecentPaymentDetails_AwaitingInvoice_class = NULL;
6961 static jmethodID LDKRecentPaymentDetails_AwaitingInvoice_meth = NULL;
6962 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
6963 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
6964 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
6965 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
6966 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
6967 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
6968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
6969         LDKRecentPaymentDetails_AwaitingInvoice_class =
6970                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$AwaitingInvoice"));
6971         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_class != NULL);
6972         LDKRecentPaymentDetails_AwaitingInvoice_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_AwaitingInvoice_class, "<init>", "([B)V");
6973         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_meth != NULL);
6974         LDKRecentPaymentDetails_Pending_class =
6975                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
6976         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
6977         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([B[BJ)V");
6978         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
6979         LDKRecentPaymentDetails_Fulfilled_class =
6980                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
6981         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
6982         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([BJ)V");
6983         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
6984         LDKRecentPaymentDetails_Abandoned_class =
6985                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
6986         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
6987         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B[B)V");
6988         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
6989 }
6990 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6991         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6992         switch(obj->tag) {
6993                 case LDKRecentPaymentDetails_AwaitingInvoice: {
6994                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
6995                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->awaiting_invoice.payment_id.data);
6996                         return (*env)->NewObject(env, LDKRecentPaymentDetails_AwaitingInvoice_class, LDKRecentPaymentDetails_AwaitingInvoice_meth, payment_id_arr);
6997                 }
6998                 case LDKRecentPaymentDetails_Pending: {
6999                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7000                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->pending.payment_id.data);
7001                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7002                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
7003                         int64_t total_msat_conv = obj->pending.total_msat;
7004                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_id_arr, payment_hash_arr, total_msat_conv);
7005                 }
7006                 case LDKRecentPaymentDetails_Fulfilled: {
7007                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7008                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->fulfilled.payment_id.data);
7009                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
7010                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_id_arr, payment_hash_ref);
7011                 }
7012                 case LDKRecentPaymentDetails_Abandoned: {
7013                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7014                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->abandoned.payment_id.data);
7015                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7016                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
7017                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_id_arr, payment_hash_arr);
7018                 }
7019                 default: abort();
7020         }
7021 }
7022 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
7023         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
7024         for (size_t i = 0; i < ret.datalen; i++) {
7025                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
7026         }
7027         return ret;
7028 }
7029 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
7030 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
7031 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
7032 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
7033 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
7034 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
7035 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
7036 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
7037 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
7038 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
7039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
7040         LDKPaymentSendFailure_ParameterError_class =
7041                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
7042         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
7043         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
7044         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
7045         LDKPaymentSendFailure_PathParameterError_class =
7046                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
7047         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
7048         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
7049         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
7050         LDKPaymentSendFailure_AllFailedResendSafe_class =
7051                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
7052         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
7053         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
7054         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
7055         LDKPaymentSendFailure_DuplicatePayment_class =
7056                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
7057         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
7058         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
7059         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
7060         LDKPaymentSendFailure_PartialFailure_class =
7061                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
7062         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
7063         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
7064         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
7065 }
7066 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7067         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
7068         switch(obj->tag) {
7069                 case LDKPaymentSendFailure_ParameterError: {
7070                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
7071                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
7072                 }
7073                 case LDKPaymentSendFailure_PathParameterError: {
7074                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
7075                         int64_tArray path_parameter_error_arr = NULL;
7076                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
7077                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
7078                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
7079                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7080                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
7081                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
7082                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
7083                         }
7084                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
7085                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
7086                 }
7087                 case LDKPaymentSendFailure_AllFailedResendSafe: {
7088                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
7089                         int64_tArray all_failed_resend_safe_arr = NULL;
7090                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
7091                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
7092                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
7093                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
7094                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
7095                         }
7096                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
7097                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
7098                 }
7099                 case LDKPaymentSendFailure_DuplicatePayment: {
7100                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
7101                 }
7102                 case LDKPaymentSendFailure_PartialFailure: {
7103                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
7104                         int64_tArray results_arr = NULL;
7105                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
7106                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
7107                         for (size_t w = 0; w < results_var.datalen; w++) {
7108                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7109                                 *results_conv_22_conv = results_var.data[w];
7110                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
7111                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
7112                         }
7113                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
7114                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
7115                         int64_t failed_paths_retry_ref = 0;
7116                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
7117                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
7118                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7119                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
7120                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
7121                 }
7122                 default: abort();
7123         }
7124 }
7125 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7126 CHECK(owner->result_ok);
7127         return *owner->contents.result;
7128 }
7129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7130         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7131         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
7132 }
7133
7134 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7135 CHECK(!owner->result_ok);
7136         return PaymentSendFailure_clone(&*owner->contents.err);
7137 }
7138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7139         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7140         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7141         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
7142         int64_t ret_ref = tag_ptr(ret_copy, true);
7143         return ret_ref;
7144 }
7145
7146 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7147 CHECK(owner->result_ok);
7148         return *owner->contents.result;
7149 }
7150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7151         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7152         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
7153 }
7154
7155 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7156 CHECK(!owner->result_ok);
7157         return RetryableSendFailure_clone(&*owner->contents.err);
7158 }
7159 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7160         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7161         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
7162         return ret_conv;
7163 }
7164
7165 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7166 CHECK(owner->result_ok);
7167         return ThirtyTwoBytes_clone(&*owner->contents.result);
7168 }
7169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7170         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7171         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7172         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data);
7173         return ret_arr;
7174 }
7175
7176 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7177 CHECK(!owner->result_ok);
7178         return PaymentSendFailure_clone(&*owner->contents.err);
7179 }
7180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7181         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7182         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7183         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
7184         int64_t ret_ref = tag_ptr(ret_copy, true);
7185         return ret_ref;
7186 }
7187
7188 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7189 CHECK(owner->result_ok);
7190         return ThirtyTwoBytes_clone(&*owner->contents.result);
7191 }
7192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7193         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7194         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7195         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data);
7196         return ret_arr;
7197 }
7198
7199 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7200 CHECK(!owner->result_ok);
7201         return RetryableSendFailure_clone(&*owner->contents.err);
7202 }
7203 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7204         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7205         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
7206         return ret_conv;
7207 }
7208
7209 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7210         return ThirtyTwoBytes_clone(&owner->a);
7211 }
7212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7213         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7214         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7215         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data);
7216         return ret_arr;
7217 }
7218
7219 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7220         return ThirtyTwoBytes_clone(&owner->b);
7221 }
7222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7223         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7224         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7225         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data);
7226         return ret_arr;
7227 }
7228
7229 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7230 CHECK(owner->result_ok);
7231         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7232 }
7233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7234         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7235         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7236         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
7237         return tag_ptr(ret_conv, true);
7238 }
7239
7240 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7241 CHECK(!owner->result_ok);
7242         return PaymentSendFailure_clone(&*owner->contents.err);
7243 }
7244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7245         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7246         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7247         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
7248         int64_t ret_ref = tag_ptr(ret_copy, true);
7249         return ret_ref;
7250 }
7251
7252 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
7253         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
7254         for (size_t i = 0; i < ret.datalen; i++) {
7255                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
7256         }
7257         return ret;
7258 }
7259 static jclass LDKProbeSendFailure_RouteNotFound_class = NULL;
7260 static jmethodID LDKProbeSendFailure_RouteNotFound_meth = NULL;
7261 static jclass LDKProbeSendFailure_SendingFailed_class = NULL;
7262 static jmethodID LDKProbeSendFailure_SendingFailed_meth = NULL;
7263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbeSendFailure_init (JNIEnv *env, jclass clz) {
7264         LDKProbeSendFailure_RouteNotFound_class =
7265                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$RouteNotFound"));
7266         CHECK(LDKProbeSendFailure_RouteNotFound_class != NULL);
7267         LDKProbeSendFailure_RouteNotFound_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_RouteNotFound_class, "<init>", "()V");
7268         CHECK(LDKProbeSendFailure_RouteNotFound_meth != NULL);
7269         LDKProbeSendFailure_SendingFailed_class =
7270                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$SendingFailed"));
7271         CHECK(LDKProbeSendFailure_SendingFailed_class != NULL);
7272         LDKProbeSendFailure_SendingFailed_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_SendingFailed_class, "<init>", "(J)V");
7273         CHECK(LDKProbeSendFailure_SendingFailed_meth != NULL);
7274 }
7275 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbeSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7276         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
7277         switch(obj->tag) {
7278                 case LDKProbeSendFailure_RouteNotFound: {
7279                         return (*env)->NewObject(env, LDKProbeSendFailure_RouteNotFound_class, LDKProbeSendFailure_RouteNotFound_meth);
7280                 }
7281                 case LDKProbeSendFailure_SendingFailed: {
7282                         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
7283                         return (*env)->NewObject(env, LDKProbeSendFailure_SendingFailed_class, LDKProbeSendFailure_SendingFailed_meth, sending_failed_ref);
7284                 }
7285                 default: abort();
7286         }
7287 }
7288 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7289 CHECK(owner->result_ok);
7290         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
7291 }
7292 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7293         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7294         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
7295         int64_tArray ret_arr = NULL;
7296         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7297         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7298         for (size_t o = 0; o < ret_var.datalen; o++) {
7299                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7300                 *ret_conv_40_conv = ret_var.data[o];
7301                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7302         }
7303         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7304         FREE(ret_var.data);
7305         return ret_arr;
7306 }
7307
7308 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7309 CHECK(!owner->result_ok);
7310         return ProbeSendFailure_clone(&*owner->contents.err);
7311 }
7312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7313         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7314         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
7315         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
7316         int64_t ret_ref = tag_ptr(ret_copy, true);
7317         return ret_ref;
7318 }
7319
7320 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7321         return ThirtyTwoBytes_clone(&owner->a);
7322 }
7323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7324         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7325         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7326         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data);
7327         return ret_arr;
7328 }
7329
7330 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7331         return owner->b;
7332 }
7333 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7334         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7335         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7336         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form);
7337         return ret_arr;
7338 }
7339
7340 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
7341         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
7342         for (size_t i = 0; i < ret.datalen; i++) {
7343                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
7344         }
7345         return ret;
7346 }
7347 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7348 CHECK(owner->result_ok);
7349         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7350 }
7351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7352         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7353         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7354         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
7355         return tag_ptr(ret_conv, true);
7356 }
7357
7358 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7359 CHECK(!owner->result_ok);
7360         return *owner->contents.err;
7361 }
7362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7363         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7364         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
7365 }
7366
7367 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7368         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
7369         ret.is_owned = false;
7370         return ret;
7371 }
7372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7373         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7374         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
7375         int64_t ret_ref = 0;
7376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7378         return ret_ref;
7379 }
7380
7381 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7382 CHECK(!owner->result_ok);
7383         return DecodeError_clone(&*owner->contents.err);
7384 }
7385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7386         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7387         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7388         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
7389         int64_t ret_ref = tag_ptr(ret_copy, true);
7390         return ret_ref;
7391 }
7392
7393 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7394         LDKChannelCounterparty ret = *owner->contents.result;
7395         ret.is_owned = false;
7396         return ret;
7397 }
7398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7399         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7400         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
7401         int64_t ret_ref = 0;
7402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7404         return ret_ref;
7405 }
7406
7407 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7408 CHECK(!owner->result_ok);
7409         return DecodeError_clone(&*owner->contents.err);
7410 }
7411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7412         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7413         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7414         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
7415         int64_t ret_ref = tag_ptr(ret_copy, true);
7416         return ret_ref;
7417 }
7418
7419 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7420         LDKChannelDetails ret = *owner->contents.result;
7421         ret.is_owned = false;
7422         return ret;
7423 }
7424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7425         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7426         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
7427         int64_t ret_ref = 0;
7428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7430         return ret_ref;
7431 }
7432
7433 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7434 CHECK(!owner->result_ok);
7435         return DecodeError_clone(&*owner->contents.err);
7436 }
7437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7438         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7439         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7440         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
7441         int64_t ret_ref = tag_ptr(ret_copy, true);
7442         return ret_ref;
7443 }
7444
7445 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7446         LDKPhantomRouteHints ret = *owner->contents.result;
7447         ret.is_owned = false;
7448         return ret;
7449 }
7450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7451         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7452         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
7453         int64_t ret_ref = 0;
7454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7456         return ret_ref;
7457 }
7458
7459 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7460 CHECK(!owner->result_ok);
7461         return DecodeError_clone(&*owner->contents.err);
7462 }
7463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7464         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7465         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7466         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
7467         int64_t ret_ref = tag_ptr(ret_copy, true);
7468         return ret_ref;
7469 }
7470
7471 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7472 CHECK(owner->result_ok);
7473         return ChannelShutdownState_clone(&*owner->contents.result);
7474 }
7475 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7476         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7477         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
7478         return ret_conv;
7479 }
7480
7481 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7482 CHECK(!owner->result_ok);
7483         return DecodeError_clone(&*owner->contents.err);
7484 }
7485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7486         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7487         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7488         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
7489         int64_t ret_ref = tag_ptr(ret_copy, true);
7490         return ret_ref;
7491 }
7492
7493 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
7494         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
7495         for (size_t i = 0; i < ret.datalen; i++) {
7496                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
7497         }
7498         return ret;
7499 }
7500 typedef struct LDKWatch_JCalls {
7501         atomic_size_t refcnt;
7502         JavaVM *vm;
7503         jweak o;
7504         jmethodID watch_channel_meth;
7505         jmethodID update_channel_meth;
7506         jmethodID release_pending_monitor_events_meth;
7507 } LDKWatch_JCalls;
7508 static void LDKWatch_JCalls_free(void* this_arg) {
7509         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7510         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7511                 JNIEnv *env;
7512                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7513                 if (get_jenv_res == JNI_EDETACHED) {
7514                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7515                 } else {
7516                         DO_ASSERT(get_jenv_res == JNI_OK);
7517                 }
7518                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7519                 if (get_jenv_res == JNI_EDETACHED) {
7520                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7521                 }
7522                 FREE(j_calls);
7523         }
7524 }
7525 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
7526         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7527         JNIEnv *env;
7528         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7529         if (get_jenv_res == JNI_EDETACHED) {
7530                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7531         } else {
7532                 DO_ASSERT(get_jenv_res == JNI_OK);
7533         }
7534         LDKOutPoint funding_txo_var = funding_txo;
7535         int64_t funding_txo_ref = 0;
7536         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7537         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7538         LDKChannelMonitor monitor_var = monitor;
7539         int64_t monitor_ref = 0;
7540         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
7541         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
7542         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7543         CHECK(obj != NULL);
7544         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
7545         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7546                 (*env)->ExceptionDescribe(env);
7547                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
7548         }
7549         void* ret_ptr = untag_ptr(ret);
7550         CHECK_ACCESS(ret_ptr);
7551         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
7552         FREE(untag_ptr(ret));
7553         if (get_jenv_res == JNI_EDETACHED) {
7554                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7555         }
7556         return ret_conv;
7557 }
7558 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
7559         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7560         JNIEnv *env;
7561         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7562         if (get_jenv_res == JNI_EDETACHED) {
7563                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7564         } else {
7565                 DO_ASSERT(get_jenv_res == JNI_OK);
7566         }
7567         LDKOutPoint funding_txo_var = funding_txo;
7568         int64_t funding_txo_ref = 0;
7569         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7570         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7571         LDKChannelMonitorUpdate update_var = *update;
7572         int64_t update_ref = 0;
7573         update_var = ChannelMonitorUpdate_clone(&update_var);
7574         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
7575         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
7576         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7577         CHECK(obj != NULL);
7578         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
7579         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7580                 (*env)->ExceptionDescribe(env);
7581                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
7582         }
7583         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7584         if (get_jenv_res == JNI_EDETACHED) {
7585                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7586         }
7587         return ret_conv;
7588 }
7589 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
7590         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7591         JNIEnv *env;
7592         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7593         if (get_jenv_res == JNI_EDETACHED) {
7594                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7595         } else {
7596                 DO_ASSERT(get_jenv_res == JNI_OK);
7597         }
7598         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7599         CHECK(obj != NULL);
7600         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
7601         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7602                 (*env)->ExceptionDescribe(env);
7603                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
7604         }
7605         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
7606         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7607         if (ret_constr.datalen > 0)
7608                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
7609         else
7610                 ret_constr.data = NULL;
7611         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7612         for (size_t x = 0; x < ret_constr.datalen; x++) {
7613                 int64_t ret_conv_49 = ret_vals[x];
7614                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
7615                 CHECK_ACCESS(ret_conv_49_ptr);
7616                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
7617                 FREE(untag_ptr(ret_conv_49));
7618                 ret_constr.data[x] = ret_conv_49_conv;
7619         }
7620         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7621         if (get_jenv_res == JNI_EDETACHED) {
7622                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7623         }
7624         return ret_constr;
7625 }
7626 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
7627         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
7628         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7629 }
7630 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
7631         jclass c = (*env)->GetObjectClass(env, o);
7632         CHECK(c != NULL);
7633         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
7634         atomic_init(&calls->refcnt, 1);
7635         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7636         calls->o = (*env)->NewWeakGlobalRef(env, o);
7637         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
7638         CHECK(calls->watch_channel_meth != NULL);
7639         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7640         CHECK(calls->update_channel_meth != NULL);
7641         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
7642         CHECK(calls->release_pending_monitor_events_meth != NULL);
7643
7644         LDKWatch ret = {
7645                 .this_arg = (void*) calls,
7646                 .watch_channel = watch_channel_LDKWatch_jcall,
7647                 .update_channel = update_channel_LDKWatch_jcall,
7648                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
7649                 .free = LDKWatch_JCalls_free,
7650         };
7651         return ret;
7652 }
7653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
7654         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
7655         *res_ptr = LDKWatch_init(env, clz, o);
7656         return tag_ptr(res_ptr, true);
7657 }
7658 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) {
7659         void* this_arg_ptr = untag_ptr(this_arg);
7660         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7661         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7662         LDKOutPoint funding_txo_conv;
7663         funding_txo_conv.inner = untag_ptr(funding_txo);
7664         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7665         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7666         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7667         LDKChannelMonitor monitor_conv;
7668         monitor_conv.inner = untag_ptr(monitor);
7669         monitor_conv.is_owned = ptr_is_owned(monitor);
7670         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
7671         monitor_conv = ChannelMonitor_clone(&monitor_conv);
7672         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
7673         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
7674         return tag_ptr(ret_conv, true);
7675 }
7676
7677 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t update) {
7678         void* this_arg_ptr = untag_ptr(this_arg);
7679         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7680         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7681         LDKOutPoint funding_txo_conv;
7682         funding_txo_conv.inner = untag_ptr(funding_txo);
7683         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7684         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7685         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7686         LDKChannelMonitorUpdate update_conv;
7687         update_conv.inner = untag_ptr(update);
7688         update_conv.is_owned = ptr_is_owned(update);
7689         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7690         update_conv.is_owned = false;
7691         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
7692         return ret_conv;
7693 }
7694
7695 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7696         void* this_arg_ptr = untag_ptr(this_arg);
7697         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7698         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7699         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
7700         int64_tArray ret_arr = NULL;
7701         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7702         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7703         for (size_t x = 0; x < ret_var.datalen; x++) {
7704                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
7705                 *ret_conv_49_conv = ret_var.data[x];
7706                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
7707         }
7708         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7709         FREE(ret_var.data);
7710         return ret_arr;
7711 }
7712
7713 typedef struct LDKBroadcasterInterface_JCalls {
7714         atomic_size_t refcnt;
7715         JavaVM *vm;
7716         jweak o;
7717         jmethodID broadcast_transactions_meth;
7718 } LDKBroadcasterInterface_JCalls;
7719 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
7720         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7721         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7722                 JNIEnv *env;
7723                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7724                 if (get_jenv_res == JNI_EDETACHED) {
7725                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7726                 } else {
7727                         DO_ASSERT(get_jenv_res == JNI_OK);
7728                 }
7729                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7730                 if (get_jenv_res == JNI_EDETACHED) {
7731                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7732                 }
7733                 FREE(j_calls);
7734         }
7735 }
7736 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
7737         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7738         JNIEnv *env;
7739         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7740         if (get_jenv_res == JNI_EDETACHED) {
7741                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7742         } else {
7743                 DO_ASSERT(get_jenv_res == JNI_OK);
7744         }
7745         LDKCVec_TransactionZ txs_var = txs;
7746         jobjectArray txs_arr = NULL;
7747         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
7748         ;
7749         for (size_t i = 0; i < txs_var.datalen; i++) {
7750                 LDKTransaction txs_conv_8_var = txs_var.data[i];
7751                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
7752                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
7753                 Transaction_free(txs_conv_8_var);
7754                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
7755         }
7756         
7757         FREE(txs_var.data);
7758         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7759         CHECK(obj != NULL);
7760         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
7761         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7762                 (*env)->ExceptionDescribe(env);
7763                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
7764         }
7765         if (get_jenv_res == JNI_EDETACHED) {
7766                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7767         }
7768 }
7769 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
7770         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
7771         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7772 }
7773 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
7774         jclass c = (*env)->GetObjectClass(env, o);
7775         CHECK(c != NULL);
7776         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
7777         atomic_init(&calls->refcnt, 1);
7778         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7779         calls->o = (*env)->NewWeakGlobalRef(env, o);
7780         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
7781         CHECK(calls->broadcast_transactions_meth != NULL);
7782
7783         LDKBroadcasterInterface ret = {
7784                 .this_arg = (void*) calls,
7785                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
7786                 .free = LDKBroadcasterInterface_JCalls_free,
7787         };
7788         return ret;
7789 }
7790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
7791         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
7792         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
7793         return tag_ptr(res_ptr, true);
7794 }
7795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
7796         void* this_arg_ptr = untag_ptr(this_arg);
7797         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7798         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
7799         LDKCVec_TransactionZ txs_constr;
7800         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
7801         if (txs_constr.datalen > 0)
7802                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7803         else
7804                 txs_constr.data = NULL;
7805         for (size_t i = 0; i < txs_constr.datalen; i++) {
7806                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
7807                 LDKTransaction txs_conv_8_ref;
7808                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
7809                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
7810                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
7811                 txs_conv_8_ref.data_is_owned = true;
7812                 txs_constr.data[i] = txs_conv_8_ref;
7813         }
7814         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
7815 }
7816
7817 typedef struct LDKEntropySource_JCalls {
7818         atomic_size_t refcnt;
7819         JavaVM *vm;
7820         jweak o;
7821         jmethodID get_secure_random_bytes_meth;
7822 } LDKEntropySource_JCalls;
7823 static void LDKEntropySource_JCalls_free(void* this_arg) {
7824         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7825         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7826                 JNIEnv *env;
7827                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7828                 if (get_jenv_res == JNI_EDETACHED) {
7829                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7830                 } else {
7831                         DO_ASSERT(get_jenv_res == JNI_OK);
7832                 }
7833                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7834                 if (get_jenv_res == JNI_EDETACHED) {
7835                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7836                 }
7837                 FREE(j_calls);
7838         }
7839 }
7840 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
7841         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7842         JNIEnv *env;
7843         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7844         if (get_jenv_res == JNI_EDETACHED) {
7845                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7846         } else {
7847                 DO_ASSERT(get_jenv_res == JNI_OK);
7848         }
7849         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7850         CHECK(obj != NULL);
7851         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
7852         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7853                 (*env)->ExceptionDescribe(env);
7854                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
7855         }
7856         LDKThirtyTwoBytes ret_ref;
7857         CHECK((*env)->GetArrayLength(env, ret) == 32);
7858         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7859         if (get_jenv_res == JNI_EDETACHED) {
7860                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7861         }
7862         return ret_ref;
7863 }
7864 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
7865         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
7866         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7867 }
7868 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
7869         jclass c = (*env)->GetObjectClass(env, o);
7870         CHECK(c != NULL);
7871         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
7872         atomic_init(&calls->refcnt, 1);
7873         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7874         calls->o = (*env)->NewWeakGlobalRef(env, o);
7875         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
7876         CHECK(calls->get_secure_random_bytes_meth != NULL);
7877
7878         LDKEntropySource ret = {
7879                 .this_arg = (void*) calls,
7880                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
7881                 .free = LDKEntropySource_JCalls_free,
7882         };
7883         return ret;
7884 }
7885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
7886         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
7887         *res_ptr = LDKEntropySource_init(env, clz, o);
7888         return tag_ptr(res_ptr, true);
7889 }
7890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
7891         void* this_arg_ptr = untag_ptr(this_arg);
7892         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7893         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
7894         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7895         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
7896         return ret_arr;
7897 }
7898
7899 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
7900 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
7901 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
7902 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
7903 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
7904 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
7905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
7906         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
7907                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
7908         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
7909         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
7910         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
7911         LDKUnsignedGossipMessage_ChannelUpdate_class =
7912                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
7913         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
7914         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
7915         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
7916         LDKUnsignedGossipMessage_NodeAnnouncement_class =
7917                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
7918         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
7919         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
7920         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
7921 }
7922 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7923         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7924         switch(obj->tag) {
7925                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
7926                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
7927                         int64_t channel_announcement_ref = 0;
7928                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
7929                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
7930                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
7931                 }
7932                 case LDKUnsignedGossipMessage_ChannelUpdate: {
7933                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
7934                         int64_t channel_update_ref = 0;
7935                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
7936                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
7937                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
7938                 }
7939                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
7940                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
7941                         int64_t node_announcement_ref = 0;
7942                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
7943                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
7944                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
7945                 }
7946                 default: abort();
7947         }
7948 }
7949 typedef struct LDKNodeSigner_JCalls {
7950         atomic_size_t refcnt;
7951         JavaVM *vm;
7952         jweak o;
7953         jmethodID get_inbound_payment_key_material_meth;
7954         jmethodID get_node_id_meth;
7955         jmethodID ecdh_meth;
7956         jmethodID sign_invoice_meth;
7957         jmethodID sign_bolt12_invoice_request_meth;
7958         jmethodID sign_bolt12_invoice_meth;
7959         jmethodID sign_gossip_message_meth;
7960 } LDKNodeSigner_JCalls;
7961 static void LDKNodeSigner_JCalls_free(void* this_arg) {
7962         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7963         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7964                 JNIEnv *env;
7965                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7966                 if (get_jenv_res == JNI_EDETACHED) {
7967                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7968                 } else {
7969                         DO_ASSERT(get_jenv_res == JNI_OK);
7970                 }
7971                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7972                 if (get_jenv_res == JNI_EDETACHED) {
7973                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7974                 }
7975                 FREE(j_calls);
7976         }
7977 }
7978 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
7979         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7980         JNIEnv *env;
7981         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7982         if (get_jenv_res == JNI_EDETACHED) {
7983                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7984         } else {
7985                 DO_ASSERT(get_jenv_res == JNI_OK);
7986         }
7987         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7988         CHECK(obj != NULL);
7989         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
7990         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7991                 (*env)->ExceptionDescribe(env);
7992                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
7993         }
7994         LDKThirtyTwoBytes ret_ref;
7995         CHECK((*env)->GetArrayLength(env, ret) == 32);
7996         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7997         if (get_jenv_res == JNI_EDETACHED) {
7998                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7999         }
8000         return ret_ref;
8001 }
8002 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
8003         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8004         JNIEnv *env;
8005         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8006         if (get_jenv_res == JNI_EDETACHED) {
8007                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8008         } else {
8009                 DO_ASSERT(get_jenv_res == JNI_OK);
8010         }
8011         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8012         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8013         CHECK(obj != NULL);
8014         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
8015         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8016                 (*env)->ExceptionDescribe(env);
8017                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
8018         }
8019         void* ret_ptr = untag_ptr(ret);
8020         CHECK_ACCESS(ret_ptr);
8021         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
8022         FREE(untag_ptr(ret));
8023         if (get_jenv_res == JNI_EDETACHED) {
8024                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8025         }
8026         return ret_conv;
8027 }
8028 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
8029         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8030         JNIEnv *env;
8031         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8032         if (get_jenv_res == JNI_EDETACHED) {
8033                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8034         } else {
8035                 DO_ASSERT(get_jenv_res == JNI_OK);
8036         }
8037         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8038         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
8039         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
8040         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
8041         *tweak_copy = tweak;
8042         int64_t tweak_ref = tag_ptr(tweak_copy, true);
8043         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8044         CHECK(obj != NULL);
8045         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
8046         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8047                 (*env)->ExceptionDescribe(env);
8048                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
8049         }
8050         void* ret_ptr = untag_ptr(ret);
8051         CHECK_ACCESS(ret_ptr);
8052         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
8053         FREE(untag_ptr(ret));
8054         if (get_jenv_res == JNI_EDETACHED) {
8055                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8056         }
8057         return ret_conv;
8058 }
8059 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
8060         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8061         JNIEnv *env;
8062         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8063         if (get_jenv_res == JNI_EDETACHED) {
8064                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8065         } else {
8066                 DO_ASSERT(get_jenv_res == JNI_OK);
8067         }
8068         LDKu8slice hrp_bytes_var = hrp_bytes;
8069         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
8070         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
8071         LDKCVec_U5Z invoice_data_var = invoice_data;
8072         jobjectArray invoice_data_arr = NULL;
8073         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
8074         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
8075         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
8076                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
8077                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
8078         }
8079         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
8080         FREE(invoice_data_var.data);
8081         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8082         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8083         CHECK(obj != NULL);
8084         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
8085         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8086                 (*env)->ExceptionDescribe(env);
8087                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
8088         }
8089         void* ret_ptr = untag_ptr(ret);
8090         CHECK_ACCESS(ret_ptr);
8091         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
8092         FREE(untag_ptr(ret));
8093         if (get_jenv_res == JNI_EDETACHED) {
8094                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8095         }
8096         return ret_conv;
8097 }
8098 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
8099         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8100         JNIEnv *env;
8101         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8102         if (get_jenv_res == JNI_EDETACHED) {
8103                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8104         } else {
8105                 DO_ASSERT(get_jenv_res == JNI_OK);
8106         }
8107         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
8108         int64_t invoice_request_ref = 0;
8109         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
8110         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
8111         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
8112         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8113         CHECK(obj != NULL);
8114         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_request_meth, invoice_request_ref);
8115         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8116                 (*env)->ExceptionDescribe(env);
8117                 (*env)->FatalError(env, "A call to sign_bolt12_invoice_request in LDKNodeSigner from rust threw an exception.");
8118         }
8119         void* ret_ptr = untag_ptr(ret);
8120         CHECK_ACCESS(ret_ptr);
8121         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8122         FREE(untag_ptr(ret));
8123         if (get_jenv_res == JNI_EDETACHED) {
8124                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8125         }
8126         return ret_conv;
8127 }
8128 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
8129         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8130         JNIEnv *env;
8131         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8132         if (get_jenv_res == JNI_EDETACHED) {
8133                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8134         } else {
8135                 DO_ASSERT(get_jenv_res == JNI_OK);
8136         }
8137         LDKUnsignedBolt12Invoice invoice_var = *invoice;
8138         int64_t invoice_ref = 0;
8139         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
8140         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
8141         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
8142         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8143         CHECK(obj != NULL);
8144         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_meth, invoice_ref);
8145         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8146                 (*env)->ExceptionDescribe(env);
8147                 (*env)->FatalError(env, "A call to sign_bolt12_invoice in LDKNodeSigner from rust threw an exception.");
8148         }
8149         void* ret_ptr = untag_ptr(ret);
8150         CHECK_ACCESS(ret_ptr);
8151         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8152         FREE(untag_ptr(ret));
8153         if (get_jenv_res == JNI_EDETACHED) {
8154                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8155         }
8156         return ret_conv;
8157 }
8158 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
8159         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8160         JNIEnv *env;
8161         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8162         if (get_jenv_res == JNI_EDETACHED) {
8163                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8164         } else {
8165                 DO_ASSERT(get_jenv_res == JNI_OK);
8166         }
8167         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
8168         *msg_copy = msg;
8169         int64_t msg_ref = tag_ptr(msg_copy, true);
8170         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8171         CHECK(obj != NULL);
8172         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
8173         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8174                 (*env)->ExceptionDescribe(env);
8175                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
8176         }
8177         void* ret_ptr = untag_ptr(ret);
8178         CHECK_ACCESS(ret_ptr);
8179         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
8180         FREE(untag_ptr(ret));
8181         if (get_jenv_res == JNI_EDETACHED) {
8182                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8183         }
8184         return ret_conv;
8185 }
8186 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
8187         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
8188         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8189 }
8190 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
8191         jclass c = (*env)->GetObjectClass(env, o);
8192         CHECK(c != NULL);
8193         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
8194         atomic_init(&calls->refcnt, 1);
8195         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8196         calls->o = (*env)->NewWeakGlobalRef(env, o);
8197         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
8198         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
8199         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
8200         CHECK(calls->get_node_id_meth != NULL);
8201         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
8202         CHECK(calls->ecdh_meth != NULL);
8203         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
8204         CHECK(calls->sign_invoice_meth != NULL);
8205         calls->sign_bolt12_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice_request", "(J)J");
8206         CHECK(calls->sign_bolt12_invoice_request_meth != NULL);
8207         calls->sign_bolt12_invoice_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice", "(J)J");
8208         CHECK(calls->sign_bolt12_invoice_meth != NULL);
8209         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
8210         CHECK(calls->sign_gossip_message_meth != NULL);
8211
8212         LDKNodeSigner ret = {
8213                 .this_arg = (void*) calls,
8214                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
8215                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
8216                 .ecdh = ecdh_LDKNodeSigner_jcall,
8217                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
8218                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
8219                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
8220                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
8221                 .free = LDKNodeSigner_JCalls_free,
8222         };
8223         return ret;
8224 }
8225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
8226         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
8227         *res_ptr = LDKNodeSigner_init(env, clz, o);
8228         return tag_ptr(res_ptr, true);
8229 }
8230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
8231         void* this_arg_ptr = untag_ptr(this_arg);
8232         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8233         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8234         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8235         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
8236         return ret_arr;
8237 }
8238
8239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
8240         void* this_arg_ptr = untag_ptr(this_arg);
8241         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8242         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8243         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8244         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
8245         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
8246         return tag_ptr(ret_conv, true);
8247 }
8248
8249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1ecdh(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient, int8_tArray other_key, int64_t tweak) {
8250         void* this_arg_ptr = untag_ptr(this_arg);
8251         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8252         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8253         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8254         LDKPublicKey other_key_ref;
8255         CHECK((*env)->GetArrayLength(env, other_key) == 33);
8256         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
8257         void* tweak_ptr = untag_ptr(tweak);
8258         CHECK_ACCESS(tweak_ptr);
8259         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
8260         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
8261         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
8262         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
8263         return tag_ptr(ret_conv, true);
8264 }
8265
8266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass recipient) {
8267         void* this_arg_ptr = untag_ptr(this_arg);
8268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8269         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8270         LDKu8slice hrp_bytes_ref;
8271         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
8272         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
8273         LDKCVec_U5Z invoice_data_constr;
8274         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
8275         if (invoice_data_constr.datalen > 0)
8276                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
8277         else
8278                 invoice_data_constr.data = NULL;
8279         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
8280         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
8281                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
8282                 
8283                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
8284         }
8285         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
8286         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8287         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8288         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
8289         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
8290         return tag_ptr(ret_conv, true);
8291 }
8292
8293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice_request) {
8294         void* this_arg_ptr = untag_ptr(this_arg);
8295         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8296         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8297         LDKUnsignedInvoiceRequest invoice_request_conv;
8298         invoice_request_conv.inner = untag_ptr(invoice_request);
8299         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
8300         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
8301         invoice_request_conv.is_owned = false;
8302         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8303         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
8304         return tag_ptr(ret_conv, true);
8305 }
8306
8307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
8308         void* this_arg_ptr = untag_ptr(this_arg);
8309         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8310         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8311         LDKUnsignedBolt12Invoice invoice_conv;
8312         invoice_conv.inner = untag_ptr(invoice);
8313         invoice_conv.is_owned = ptr_is_owned(invoice);
8314         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
8315         invoice_conv.is_owned = false;
8316         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8317         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
8318         return tag_ptr(ret_conv, true);
8319 }
8320
8321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8322         void* this_arg_ptr = untag_ptr(this_arg);
8323         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8324         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8325         void* msg_ptr = untag_ptr(msg);
8326         CHECK_ACCESS(msg_ptr);
8327         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
8328         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
8329         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
8330         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
8331         return tag_ptr(ret_conv, true);
8332 }
8333
8334 typedef struct LDKSignerProvider_JCalls {
8335         atomic_size_t refcnt;
8336         JavaVM *vm;
8337         jweak o;
8338         jmethodID generate_channel_keys_id_meth;
8339         jmethodID derive_channel_signer_meth;
8340         jmethodID read_chan_signer_meth;
8341         jmethodID get_destination_script_meth;
8342         jmethodID get_shutdown_scriptpubkey_meth;
8343 } LDKSignerProvider_JCalls;
8344 static void LDKSignerProvider_JCalls_free(void* this_arg) {
8345         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8346         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8347                 JNIEnv *env;
8348                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8349                 if (get_jenv_res == JNI_EDETACHED) {
8350                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8351                 } else {
8352                         DO_ASSERT(get_jenv_res == JNI_OK);
8353                 }
8354                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8355                 if (get_jenv_res == JNI_EDETACHED) {
8356                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8357                 }
8358                 FREE(j_calls);
8359         }
8360 }
8361 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
8362         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8363         JNIEnv *env;
8364         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8365         if (get_jenv_res == JNI_EDETACHED) {
8366                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8367         } else {
8368                 DO_ASSERT(get_jenv_res == JNI_OK);
8369         }
8370         jboolean inbound_conv = inbound;
8371         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8372         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
8373         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
8374         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8375         CHECK(obj != NULL);
8376         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
8377         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8378                 (*env)->ExceptionDescribe(env);
8379                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
8380         }
8381         LDKThirtyTwoBytes ret_ref;
8382         CHECK((*env)->GetArrayLength(env, ret) == 32);
8383         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8384         if (get_jenv_res == JNI_EDETACHED) {
8385                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8386         }
8387         return ret_ref;
8388 }
8389 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
8390         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8391         JNIEnv *env;
8392         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8393         if (get_jenv_res == JNI_EDETACHED) {
8394                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8395         } else {
8396                 DO_ASSERT(get_jenv_res == JNI_OK);
8397         }
8398         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8399         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
8400         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
8401         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8402         CHECK(obj != NULL);
8403         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
8404         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8405                 (*env)->ExceptionDescribe(env);
8406                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
8407         }
8408         void* ret_ptr = untag_ptr(ret);
8409         CHECK_ACCESS(ret_ptr);
8410         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
8411         FREE(untag_ptr(ret));
8412         if (get_jenv_res == JNI_EDETACHED) {
8413                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8414         }
8415         return ret_conv;
8416 }
8417 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
8418         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8419         JNIEnv *env;
8420         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8421         if (get_jenv_res == JNI_EDETACHED) {
8422                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8423         } else {
8424                 DO_ASSERT(get_jenv_res == JNI_OK);
8425         }
8426         LDKu8slice reader_var = reader;
8427         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
8428         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
8429         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8430         CHECK(obj != NULL);
8431         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
8432         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8433                 (*env)->ExceptionDescribe(env);
8434                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
8435         }
8436         void* ret_ptr = untag_ptr(ret);
8437         CHECK_ACCESS(ret_ptr);
8438         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
8439         FREE(untag_ptr(ret));
8440         if (get_jenv_res == JNI_EDETACHED) {
8441                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8442         }
8443         return ret_conv;
8444 }
8445 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
8446         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8447         JNIEnv *env;
8448         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8449         if (get_jenv_res == JNI_EDETACHED) {
8450                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8451         } else {
8452                 DO_ASSERT(get_jenv_res == JNI_OK);
8453         }
8454         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8455         CHECK(obj != NULL);
8456         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
8457         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8458                 (*env)->ExceptionDescribe(env);
8459                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
8460         }
8461         void* ret_ptr = untag_ptr(ret);
8462         CHECK_ACCESS(ret_ptr);
8463         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
8464         FREE(untag_ptr(ret));
8465         if (get_jenv_res == JNI_EDETACHED) {
8466                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8467         }
8468         return ret_conv;
8469 }
8470 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
8471         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8472         JNIEnv *env;
8473         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8474         if (get_jenv_res == JNI_EDETACHED) {
8475                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8476         } else {
8477                 DO_ASSERT(get_jenv_res == JNI_OK);
8478         }
8479         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8480         CHECK(obj != NULL);
8481         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
8482         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8483                 (*env)->ExceptionDescribe(env);
8484                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
8485         }
8486         void* ret_ptr = untag_ptr(ret);
8487         CHECK_ACCESS(ret_ptr);
8488         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
8489         FREE(untag_ptr(ret));
8490         if (get_jenv_res == JNI_EDETACHED) {
8491                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8492         }
8493         return ret_conv;
8494 }
8495 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
8496         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
8497         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8498 }
8499 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
8500         jclass c = (*env)->GetObjectClass(env, o);
8501         CHECK(c != NULL);
8502         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
8503         atomic_init(&calls->refcnt, 1);
8504         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8505         calls->o = (*env)->NewWeakGlobalRef(env, o);
8506         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
8507         CHECK(calls->generate_channel_keys_id_meth != NULL);
8508         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
8509         CHECK(calls->derive_channel_signer_meth != NULL);
8510         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
8511         CHECK(calls->read_chan_signer_meth != NULL);
8512         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
8513         CHECK(calls->get_destination_script_meth != NULL);
8514         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
8515         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
8516
8517         LDKSignerProvider ret = {
8518                 .this_arg = (void*) calls,
8519                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
8520                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
8521                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
8522                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
8523                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
8524                 .free = LDKSignerProvider_JCalls_free,
8525         };
8526         return ret;
8527 }
8528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
8529         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
8530         *res_ptr = LDKSignerProvider_init(env, clz, o);
8531         return tag_ptr(res_ptr, true);
8532 }
8533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1generate_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) {
8534         void* this_arg_ptr = untag_ptr(this_arg);
8535         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8536         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8537         LDKU128 user_channel_id_ref;
8538         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
8539         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
8540         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8541         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->generate_channel_keys_id)(this_arg_conv->this_arg, inbound, channel_value_satoshis, user_channel_id_ref).data);
8542         return ret_arr;
8543 }
8544
8545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
8546         void* this_arg_ptr = untag_ptr(this_arg);
8547         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8548         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8549         LDKThirtyTwoBytes channel_keys_id_ref;
8550         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
8551         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
8552         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
8553         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
8554         return tag_ptr(ret_ret, true);
8555 }
8556
8557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
8558         void* this_arg_ptr = untag_ptr(this_arg);
8559         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8560         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8561         LDKu8slice reader_ref;
8562         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
8563         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
8564         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
8565         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
8566         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
8567         return tag_ptr(ret_conv, true);
8568 }
8569
8570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
8571         void* this_arg_ptr = untag_ptr(this_arg);
8572         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8573         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8574         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
8575         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
8576         return tag_ptr(ret_conv, true);
8577 }
8578
8579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
8580         void* this_arg_ptr = untag_ptr(this_arg);
8581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8582         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8583         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
8584         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
8585         return tag_ptr(ret_conv, true);
8586 }
8587
8588 typedef struct LDKFeeEstimator_JCalls {
8589         atomic_size_t refcnt;
8590         JavaVM *vm;
8591         jweak o;
8592         jmethodID get_est_sat_per_1000_weight_meth;
8593 } LDKFeeEstimator_JCalls;
8594 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
8595         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8596         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8597                 JNIEnv *env;
8598                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8599                 if (get_jenv_res == JNI_EDETACHED) {
8600                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8601                 } else {
8602                         DO_ASSERT(get_jenv_res == JNI_OK);
8603                 }
8604                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8605                 if (get_jenv_res == JNI_EDETACHED) {
8606                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8607                 }
8608                 FREE(j_calls);
8609         }
8610 }
8611 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
8612         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8613         JNIEnv *env;
8614         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8615         if (get_jenv_res == JNI_EDETACHED) {
8616                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8617         } else {
8618                 DO_ASSERT(get_jenv_res == JNI_OK);
8619         }
8620         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
8621         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8622         CHECK(obj != NULL);
8623         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
8624         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8625                 (*env)->ExceptionDescribe(env);
8626                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
8627         }
8628         if (get_jenv_res == JNI_EDETACHED) {
8629                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8630         }
8631         return ret;
8632 }
8633 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
8634         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
8635         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8636 }
8637 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
8638         jclass c = (*env)->GetObjectClass(env, o);
8639         CHECK(c != NULL);
8640         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
8641         atomic_init(&calls->refcnt, 1);
8642         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8643         calls->o = (*env)->NewWeakGlobalRef(env, o);
8644         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
8645         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
8646
8647         LDKFeeEstimator ret = {
8648                 .this_arg = (void*) calls,
8649                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
8650                 .free = LDKFeeEstimator_JCalls_free,
8651         };
8652         return ret;
8653 }
8654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
8655         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
8656         *res_ptr = LDKFeeEstimator_init(env, clz, o);
8657         return tag_ptr(res_ptr, true);
8658 }
8659 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) {
8660         void* this_arg_ptr = untag_ptr(this_arg);
8661         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8662         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
8663         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
8664         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
8665         return ret_conv;
8666 }
8667
8668 typedef struct LDKRouter_JCalls {
8669         atomic_size_t refcnt;
8670         JavaVM *vm;
8671         jweak o;
8672         jmethodID find_route_meth;
8673         jmethodID find_route_with_id_meth;
8674 } LDKRouter_JCalls;
8675 static void LDKRouter_JCalls_free(void* this_arg) {
8676         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8677         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8678                 JNIEnv *env;
8679                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8680                 if (get_jenv_res == JNI_EDETACHED) {
8681                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8682                 } else {
8683                         DO_ASSERT(get_jenv_res == JNI_OK);
8684                 }
8685                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8686                 if (get_jenv_res == JNI_EDETACHED) {
8687                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8688                 }
8689                 FREE(j_calls);
8690         }
8691 }
8692 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
8693         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8694         JNIEnv *env;
8695         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8696         if (get_jenv_res == JNI_EDETACHED) {
8697                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8698         } else {
8699                 DO_ASSERT(get_jenv_res == JNI_OK);
8700         }
8701         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8702         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8703         LDKRouteParameters route_params_var = *route_params;
8704         int64_t route_params_ref = 0;
8705         route_params_var = RouteParameters_clone(&route_params_var);
8706         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8707         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8708         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8709         int64_tArray first_hops_arr = NULL;
8710         if (first_hops != NULL) {
8711                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8712                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8713                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8714                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8715                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8716                         int64_t first_hops_conv_16_ref = 0;
8717                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8718                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8719                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8720                 }
8721                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8722         }
8723         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8724         int64_t inflight_htlcs_ref = 0;
8725         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8726         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8727         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8728         CHECK(obj != NULL);
8729         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
8730         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8731                 (*env)->ExceptionDescribe(env);
8732                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
8733         }
8734         void* ret_ptr = untag_ptr(ret);
8735         CHECK_ACCESS(ret_ptr);
8736         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8737         FREE(untag_ptr(ret));
8738         if (get_jenv_res == JNI_EDETACHED) {
8739                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8740         }
8741         return ret_conv;
8742 }
8743 LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) {
8744         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8745         JNIEnv *env;
8746         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8747         if (get_jenv_res == JNI_EDETACHED) {
8748                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8749         } else {
8750                 DO_ASSERT(get_jenv_res == JNI_OK);
8751         }
8752         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8753         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8754         LDKRouteParameters route_params_var = *route_params;
8755         int64_t route_params_ref = 0;
8756         route_params_var = RouteParameters_clone(&route_params_var);
8757         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8758         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8759         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8760         int64_tArray first_hops_arr = NULL;
8761         if (first_hops != NULL) {
8762                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8763                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8764                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8765                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8766                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8767                         int64_t first_hops_conv_16_ref = 0;
8768                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8769                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8770                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8771                 }
8772                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8773         }
8774         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8775         int64_t inflight_htlcs_ref = 0;
8776         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8777         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8778         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
8779         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
8780         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
8781         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
8782         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8783         CHECK(obj != NULL);
8784         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_with_id_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref, _payment_hash_arr, _payment_id_arr);
8785         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8786                 (*env)->ExceptionDescribe(env);
8787                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
8788         }
8789         void* ret_ptr = untag_ptr(ret);
8790         CHECK_ACCESS(ret_ptr);
8791         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8792         FREE(untag_ptr(ret));
8793         if (get_jenv_res == JNI_EDETACHED) {
8794                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8795         }
8796         return ret_conv;
8797 }
8798 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
8799         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
8800         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8801 }
8802 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
8803         jclass c = (*env)->GetObjectClass(env, o);
8804         CHECK(c != NULL);
8805         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
8806         atomic_init(&calls->refcnt, 1);
8807         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8808         calls->o = (*env)->NewWeakGlobalRef(env, o);
8809         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
8810         CHECK(calls->find_route_meth != NULL);
8811         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
8812         CHECK(calls->find_route_with_id_meth != NULL);
8813
8814         LDKRouter ret = {
8815                 .this_arg = (void*) calls,
8816                 .find_route = find_route_LDKRouter_jcall,
8817                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
8818                 .free = LDKRouter_JCalls_free,
8819         };
8820         return ret;
8821 }
8822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
8823         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
8824         *res_ptr = LDKRouter_init(env, clz, o);
8825         return tag_ptr(res_ptr, true);
8826 }
8827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs) {
8828         void* this_arg_ptr = untag_ptr(this_arg);
8829         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8830         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8831         LDKPublicKey payer_ref;
8832         CHECK((*env)->GetArrayLength(env, payer) == 33);
8833         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8834         LDKRouteParameters route_params_conv;
8835         route_params_conv.inner = untag_ptr(route_params);
8836         route_params_conv.is_owned = ptr_is_owned(route_params);
8837         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8838         route_params_conv.is_owned = false;
8839         LDKCVec_ChannelDetailsZ first_hops_constr;
8840         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8841         if (first_hops != NULL) {
8842                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8843                 if (first_hops_constr.datalen > 0)
8844                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8845                 else
8846                         first_hops_constr.data = NULL;
8847                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8848                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8849                         int64_t first_hops_conv_16 = first_hops_vals[q];
8850                         LDKChannelDetails first_hops_conv_16_conv;
8851                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8852                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8853                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8854                         first_hops_conv_16_conv.is_owned = false;
8855                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8856                 }
8857                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8858                 first_hops_ptr = &first_hops_constr;
8859         }
8860         LDKInFlightHtlcs inflight_htlcs_conv;
8861         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8862         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8863         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8864         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
8865         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8866         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
8867         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8868         return tag_ptr(ret_conv, true);
8869 }
8870
8871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) {
8872         void* this_arg_ptr = untag_ptr(this_arg);
8873         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8874         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8875         LDKPublicKey payer_ref;
8876         CHECK((*env)->GetArrayLength(env, payer) == 33);
8877         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8878         LDKRouteParameters route_params_conv;
8879         route_params_conv.inner = untag_ptr(route_params);
8880         route_params_conv.is_owned = ptr_is_owned(route_params);
8881         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8882         route_params_conv.is_owned = false;
8883         LDKCVec_ChannelDetailsZ first_hops_constr;
8884         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8885         if (first_hops != NULL) {
8886                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8887                 if (first_hops_constr.datalen > 0)
8888                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8889                 else
8890                         first_hops_constr.data = NULL;
8891                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8892                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8893                         int64_t first_hops_conv_16 = first_hops_vals[q];
8894                         LDKChannelDetails first_hops_conv_16_conv;
8895                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8896                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8897                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8898                         first_hops_conv_16_conv.is_owned = false;
8899                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8900                 }
8901                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8902                 first_hops_ptr = &first_hops_constr;
8903         }
8904         LDKInFlightHtlcs inflight_htlcs_conv;
8905         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8906         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8907         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8908         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
8909         LDKThirtyTwoBytes _payment_hash_ref;
8910         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
8911         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
8912         LDKThirtyTwoBytes _payment_id_ref;
8913         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
8914         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
8915         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8916         *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref);
8917         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8918         return tag_ptr(ret_conv, true);
8919 }
8920
8921 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
8922         return ThirtyTwoBytes_clone(&owner->a);
8923 }
8924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8925         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
8926         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8927         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data);
8928         return ret_arr;
8929 }
8930
8931 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
8932         LDKChannelManager ret = owner->b;
8933         ret.is_owned = false;
8934         return ret;
8935 }
8936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8937         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
8938         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
8939         int64_t ret_ref = 0;
8940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8942         return ret_ref;
8943 }
8944
8945 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8946 CHECK(owner->result_ok);
8947         return &*owner->contents.result;
8948 }
8949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8950         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8951         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
8952         return ret_ret;
8953 }
8954
8955 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8956 CHECK(!owner->result_ok);
8957         return DecodeError_clone(&*owner->contents.err);
8958 }
8959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8960         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8961         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8962         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
8963         int64_t ret_ref = tag_ptr(ret_copy, true);
8964         return ret_ref;
8965 }
8966
8967 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
8968 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
8969 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
8970 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
8971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
8972         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
8973                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
8974         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
8975         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
8976         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
8977         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
8978                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
8979         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
8980         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
8981         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
8982 }
8983 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8984         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8985         switch(obj->tag) {
8986                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
8987                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
8988                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
8989                 }
8990                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
8991                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
8992                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
8993                 }
8994                 default: abort();
8995         }
8996 }
8997 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8998 CHECK(owner->result_ok);
8999         return MaxDustHTLCExposure_clone(&*owner->contents.result);
9000 }
9001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9002         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9003         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
9004         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
9005         int64_t ret_ref = tag_ptr(ret_copy, true);
9006         return ret_ref;
9007 }
9008
9009 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9010 CHECK(!owner->result_ok);
9011         return DecodeError_clone(&*owner->contents.err);
9012 }
9013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9014         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9015         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9016         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
9017         int64_t ret_ref = tag_ptr(ret_copy, true);
9018         return ret_ref;
9019 }
9020
9021 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9022         LDKChannelConfig ret = *owner->contents.result;
9023         ret.is_owned = false;
9024         return ret;
9025 }
9026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9027         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9028         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
9029         int64_t ret_ref = 0;
9030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9032         return ret_ref;
9033 }
9034
9035 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9036 CHECK(!owner->result_ok);
9037         return DecodeError_clone(&*owner->contents.err);
9038 }
9039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9040         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9041         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9042         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
9043         int64_t ret_ref = tag_ptr(ret_copy, true);
9044         return ret_ref;
9045 }
9046
9047 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
9048 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
9049 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
9050 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
9051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
9052         LDKCOption_MaxDustHTLCExposureZ_Some_class =
9053                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
9054         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
9055         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
9056         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
9057         LDKCOption_MaxDustHTLCExposureZ_None_class =
9058                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
9059         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
9060         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
9061         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
9062 }
9063 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9064         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
9065         switch(obj->tag) {
9066                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
9067                         int64_t some_ref = tag_ptr(&obj->some, false);
9068                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
9069                 }
9070                 case LDKCOption_MaxDustHTLCExposureZ_None: {
9071                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
9072                 }
9073                 default: abort();
9074         }
9075 }
9076 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
9077 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
9078 static jclass LDKCOption_APIErrorZ_None_class = NULL;
9079 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
9080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
9081         LDKCOption_APIErrorZ_Some_class =
9082                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
9083         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
9084         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
9085         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
9086         LDKCOption_APIErrorZ_None_class =
9087                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
9088         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
9089         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
9090         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
9091 }
9092 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9093         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
9094         switch(obj->tag) {
9095                 case LDKCOption_APIErrorZ_Some: {
9096                         int64_t some_ref = tag_ptr(&obj->some, false);
9097                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
9098                 }
9099                 case LDKCOption_APIErrorZ_None: {
9100                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
9101                 }
9102                 default: abort();
9103         }
9104 }
9105 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
9106 CHECK(owner->result_ok);
9107         return COption_APIErrorZ_clone(&*owner->contents.result);
9108 }
9109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9110         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
9111         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
9112         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
9113         int64_t ret_ref = tag_ptr(ret_copy, true);
9114         return ret_ref;
9115 }
9116
9117 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
9118 CHECK(!owner->result_ok);
9119         return DecodeError_clone(&*owner->contents.err);
9120 }
9121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9122         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
9123         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9124         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
9125         int64_t ret_ref = tag_ptr(ret_copy, true);
9126         return ret_ref;
9127 }
9128
9129 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9130         LDKChannelMonitorUpdate ret = *owner->contents.result;
9131         ret.is_owned = false;
9132         return ret;
9133 }
9134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9135         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9136         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
9137         int64_t ret_ref = 0;
9138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9140         return ret_ref;
9141 }
9142
9143 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9144 CHECK(!owner->result_ok);
9145         return DecodeError_clone(&*owner->contents.err);
9146 }
9147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9148         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9149         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9150         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
9151         int64_t ret_ref = tag_ptr(ret_copy, true);
9152         return ret_ref;
9153 }
9154
9155 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
9156 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
9157 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
9158 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
9159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
9160         LDKCOption_MonitorEventZ_Some_class =
9161                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
9162         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
9163         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
9164         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
9165         LDKCOption_MonitorEventZ_None_class =
9166                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
9167         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
9168         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
9169         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
9170 }
9171 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9172         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
9173         switch(obj->tag) {
9174                 case LDKCOption_MonitorEventZ_Some: {
9175                         int64_t some_ref = tag_ptr(&obj->some, false);
9176                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
9177                 }
9178                 case LDKCOption_MonitorEventZ_None: {
9179                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
9180                 }
9181                 default: abort();
9182         }
9183 }
9184 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9185 CHECK(owner->result_ok);
9186         return COption_MonitorEventZ_clone(&*owner->contents.result);
9187 }
9188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9189         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9190         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9191         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
9192         int64_t ret_ref = tag_ptr(ret_copy, true);
9193         return ret_ref;
9194 }
9195
9196 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9197 CHECK(!owner->result_ok);
9198         return DecodeError_clone(&*owner->contents.err);
9199 }
9200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9201         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9202         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9203         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
9204         int64_t ret_ref = tag_ptr(ret_copy, true);
9205         return ret_ref;
9206 }
9207
9208 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9209         LDKHTLCUpdate ret = *owner->contents.result;
9210         ret.is_owned = false;
9211         return ret;
9212 }
9213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9214         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9215         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
9216         int64_t ret_ref = 0;
9217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9219         return ret_ref;
9220 }
9221
9222 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9223 CHECK(!owner->result_ok);
9224         return DecodeError_clone(&*owner->contents.err);
9225 }
9226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9227         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9228         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9229         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
9230         int64_t ret_ref = tag_ptr(ret_copy, true);
9231         return ret_ref;
9232 }
9233
9234 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
9235         LDKOutPoint ret = owner->a;
9236         ret.is_owned = false;
9237         return ret;
9238 }
9239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9240         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
9241         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
9242         int64_t ret_ref = 0;
9243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9245         return ret_ref;
9246 }
9247
9248 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
9249         return CVec_u8Z_clone(&owner->b);
9250 }
9251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9252         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
9253         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
9254         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9255         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9256         CVec_u8Z_free(ret_var);
9257         return ret_arr;
9258 }
9259
9260 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
9261         return owner->a;
9262 }
9263 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9264         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
9265         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
9266         return ret_conv;
9267 }
9268
9269 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
9270         return CVec_u8Z_clone(&owner->b);
9271 }
9272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9273         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
9274         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
9275         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9276         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9277         CVec_u8Z_free(ret_var);
9278         return ret_arr;
9279 }
9280
9281 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
9282         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
9283         for (size_t i = 0; i < ret.datalen; i++) {
9284                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
9285         }
9286         return ret;
9287 }
9288 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
9289         return ThirtyTwoBytes_clone(&owner->a);
9290 }
9291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9292         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
9293         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9294         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data);
9295         return ret_arr;
9296 }
9297
9298 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
9299         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
9300 }
9301 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9302         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
9303         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
9304         int64_tArray ret_arr = NULL;
9305         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9306         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9307         for (size_t x = 0; x < ret_var.datalen; x++) {
9308                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
9309                 *ret_conv_23_conv = ret_var.data[x];
9310                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
9311         }
9312         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9313         FREE(ret_var.data);
9314         return ret_arr;
9315 }
9316
9317 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
9318         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ clone bytes"), .datalen = orig->datalen };
9319         for (size_t i = 0; i < ret.datalen; i++) {
9320                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
9321         }
9322         return ret;
9323 }
9324 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
9325         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
9326         for (size_t i = 0; i < ret.datalen; i++) {
9327                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
9328         }
9329         return ret;
9330 }
9331 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9332         return owner->a;
9333 }
9334 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9335         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9336         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
9337         return ret_conv;
9338 }
9339
9340 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9341         return TxOut_clone(&owner->b);
9342 }
9343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9344         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9345         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9346         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
9347         return tag_ptr(ret_ref, true);
9348 }
9349
9350 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
9351         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
9352         for (size_t i = 0; i < ret.datalen; i++) {
9353                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
9354         }
9355         return ret;
9356 }
9357 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9358         return ThirtyTwoBytes_clone(&owner->a);
9359 }
9360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9361         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9362         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9363         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
9364         return ret_arr;
9365 }
9366
9367 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9368         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
9369 }
9370 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9371         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9372         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
9373         int64_tArray ret_arr = NULL;
9374         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9375         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9376         for (size_t u = 0; u < ret_var.datalen; u++) {
9377                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9378                 *ret_conv_20_conv = ret_var.data[u];
9379                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
9380         }
9381         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9382         FREE(ret_var.data);
9383         return ret_arr;
9384 }
9385
9386 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
9387         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
9388         for (size_t i = 0; i < ret.datalen; i++) {
9389                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
9390         }
9391         return ret;
9392 }
9393 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
9394 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
9395 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
9396 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
9397 static jclass LDKBalance_ContentiousClaimable_class = NULL;
9398 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
9399 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
9400 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
9401 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
9402 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
9403 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
9404 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
9405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
9406         LDKBalance_ClaimableOnChannelClose_class =
9407                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
9408         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
9409         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
9410         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
9411         LDKBalance_ClaimableAwaitingConfirmations_class =
9412                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
9413         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
9414         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
9415         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
9416         LDKBalance_ContentiousClaimable_class =
9417                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
9418         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
9419         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
9420         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
9421         LDKBalance_MaybeTimeoutClaimableHTLC_class =
9422                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
9423         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
9424         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
9425         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
9426         LDKBalance_MaybePreimageClaimableHTLC_class =
9427                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
9428         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
9429         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
9430         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
9431         LDKBalance_CounterpartyRevokedOutputClaimable_class =
9432                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
9433         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
9434         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
9435         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
9436 }
9437 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9438         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
9439         switch(obj->tag) {
9440                 case LDKBalance_ClaimableOnChannelClose: {
9441                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
9442                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
9443                 }
9444                 case LDKBalance_ClaimableAwaitingConfirmations: {
9445                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
9446                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
9447                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
9448                 }
9449                 case LDKBalance_ContentiousClaimable: {
9450                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
9451                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
9452                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9453                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
9454                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
9455                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
9456                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
9457                 }
9458                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
9459                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
9460                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
9461                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9462                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
9463                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
9464                 }
9465                 case LDKBalance_MaybePreimageClaimableHTLC: {
9466                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
9467                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
9468                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9469                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
9470                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
9471                 }
9472                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
9473                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
9474                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
9475                 }
9476                 default: abort();
9477         }
9478 }
9479 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
9480         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
9481         for (size_t i = 0; i < ret.datalen; i++) {
9482                 ret.data[i] = Balance_clone(&orig->data[i]);
9483         }
9484         return ret;
9485 }
9486 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
9487         return ThirtyTwoBytes_clone(&owner->a);
9488 }
9489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9490         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
9491         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9492         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data);
9493         return ret_arr;
9494 }
9495
9496 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
9497         LDKChannelMonitor ret = owner->b;
9498         ret.is_owned = false;
9499         return ret;
9500 }
9501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9502         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
9503         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
9504         int64_t ret_ref = 0;
9505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9507         return ret_ref;
9508 }
9509
9510 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9511 CHECK(owner->result_ok);
9512         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
9513 }
9514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9515         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9516         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
9517         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
9518         return tag_ptr(ret_conv, true);
9519 }
9520
9521 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9522 CHECK(!owner->result_ok);
9523         return DecodeError_clone(&*owner->contents.err);
9524 }
9525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9526         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9527         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9528         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
9529         int64_t ret_ref = tag_ptr(ret_copy, true);
9530         return ret_ref;
9531 }
9532
9533 typedef struct LDKType_JCalls {
9534         atomic_size_t refcnt;
9535         JavaVM *vm;
9536         jweak o;
9537         jmethodID type_id_meth;
9538         jmethodID debug_str_meth;
9539         jmethodID write_meth;
9540 } LDKType_JCalls;
9541 static void LDKType_JCalls_free(void* this_arg) {
9542         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9543         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9544                 JNIEnv *env;
9545                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9546                 if (get_jenv_res == JNI_EDETACHED) {
9547                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9548                 } else {
9549                         DO_ASSERT(get_jenv_res == JNI_OK);
9550                 }
9551                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9552                 if (get_jenv_res == JNI_EDETACHED) {
9553                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9554                 }
9555                 FREE(j_calls);
9556         }
9557 }
9558 uint16_t type_id_LDKType_jcall(const void* this_arg) {
9559         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9560         JNIEnv *env;
9561         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9562         if (get_jenv_res == JNI_EDETACHED) {
9563                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9564         } else {
9565                 DO_ASSERT(get_jenv_res == JNI_OK);
9566         }
9567         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9568         CHECK(obj != NULL);
9569         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
9570         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9571                 (*env)->ExceptionDescribe(env);
9572                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
9573         }
9574         if (get_jenv_res == JNI_EDETACHED) {
9575                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9576         }
9577         return ret;
9578 }
9579 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
9580         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9581         JNIEnv *env;
9582         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9583         if (get_jenv_res == JNI_EDETACHED) {
9584                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9585         } else {
9586                 DO_ASSERT(get_jenv_res == JNI_OK);
9587         }
9588         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9589         CHECK(obj != NULL);
9590         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
9591         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9592                 (*env)->ExceptionDescribe(env);
9593                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
9594         }
9595         LDKStr ret_conv = java_to_owned_str(env, ret);
9596         if (get_jenv_res == JNI_EDETACHED) {
9597                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9598         }
9599         return ret_conv;
9600 }
9601 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
9602         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9603         JNIEnv *env;
9604         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9605         if (get_jenv_res == JNI_EDETACHED) {
9606                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9607         } else {
9608                 DO_ASSERT(get_jenv_res == JNI_OK);
9609         }
9610         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9611         CHECK(obj != NULL);
9612         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9613         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9614                 (*env)->ExceptionDescribe(env);
9615                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
9616         }
9617         LDKCVec_u8Z ret_ref;
9618         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9619         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9620         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9621         if (get_jenv_res == JNI_EDETACHED) {
9622                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9623         }
9624         return ret_ref;
9625 }
9626 static void LDKType_JCalls_cloned(LDKType* new_obj) {
9627         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
9628         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9629 }
9630 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
9631         jclass c = (*env)->GetObjectClass(env, o);
9632         CHECK(c != NULL);
9633         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
9634         atomic_init(&calls->refcnt, 1);
9635         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9636         calls->o = (*env)->NewWeakGlobalRef(env, o);
9637         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
9638         CHECK(calls->type_id_meth != NULL);
9639         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
9640         CHECK(calls->debug_str_meth != NULL);
9641         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9642         CHECK(calls->write_meth != NULL);
9643
9644         LDKType ret = {
9645                 .this_arg = (void*) calls,
9646                 .type_id = type_id_LDKType_jcall,
9647                 .debug_str = debug_str_LDKType_jcall,
9648                 .write = write_LDKType_jcall,
9649                 .cloned = LDKType_JCalls_cloned,
9650                 .free = LDKType_JCalls_free,
9651         };
9652         return ret;
9653 }
9654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
9655         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
9656         *res_ptr = LDKType_init(env, clz, o);
9657         return tag_ptr(res_ptr, true);
9658 }
9659 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9660         void* this_arg_ptr = untag_ptr(this_arg);
9661         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9662         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9663         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
9664         return ret_conv;
9665 }
9666
9667 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
9668         void* this_arg_ptr = untag_ptr(this_arg);
9669         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9670         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9671         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
9672         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9673         Str_free(ret_str);
9674         return ret_conv;
9675 }
9676
9677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9678         void* this_arg_ptr = untag_ptr(this_arg);
9679         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9680         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9681         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9682         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9683         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9684         CVec_u8Z_free(ret_var);
9685         return ret_arr;
9686 }
9687
9688 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9689         return owner->a;
9690 }
9691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9692         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9693         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9694         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
9695         return ret_arr;
9696 }
9697
9698 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9699         return Type_clone(&owner->b);
9700 }
9701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9702         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9703         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
9704         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
9705         return tag_ptr(ret_ret, true);
9706 }
9707
9708 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
9709         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
9710         for (size_t i = 0; i < ret.datalen; i++) {
9711                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
9712         }
9713         return ret;
9714 }
9715 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
9716 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
9717 static jclass LDKOffersMessage_Invoice_class = NULL;
9718 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
9719 static jclass LDKOffersMessage_InvoiceError_class = NULL;
9720 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
9721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
9722         LDKOffersMessage_InvoiceRequest_class =
9723                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
9724         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
9725         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
9726         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
9727         LDKOffersMessage_Invoice_class =
9728                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
9729         CHECK(LDKOffersMessage_Invoice_class != NULL);
9730         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
9731         CHECK(LDKOffersMessage_Invoice_meth != NULL);
9732         LDKOffersMessage_InvoiceError_class =
9733                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
9734         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
9735         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
9736         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
9737 }
9738 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9739         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
9740         switch(obj->tag) {
9741                 case LDKOffersMessage_InvoiceRequest: {
9742                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
9743                         int64_t invoice_request_ref = 0;
9744                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
9745                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
9746                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
9747                 }
9748                 case LDKOffersMessage_Invoice: {
9749                         LDKBolt12Invoice invoice_var = obj->invoice;
9750                         int64_t invoice_ref = 0;
9751                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
9752                         invoice_ref = tag_ptr(invoice_var.inner, false);
9753                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
9754                 }
9755                 case LDKOffersMessage_InvoiceError: {
9756                         LDKInvoiceError invoice_error_var = obj->invoice_error;
9757                         int64_t invoice_error_ref = 0;
9758                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
9759                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
9760                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
9761                 }
9762                 default: abort();
9763         }
9764 }
9765 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
9766 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
9767 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
9768 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
9769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
9770         LDKCOption_OffersMessageZ_Some_class =
9771                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
9772         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
9773         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
9774         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
9775         LDKCOption_OffersMessageZ_None_class =
9776                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
9777         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
9778         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
9779         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
9780 }
9781 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9782         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
9783         switch(obj->tag) {
9784                 case LDKCOption_OffersMessageZ_Some: {
9785                         int64_t some_ref = tag_ptr(&obj->some, false);
9786                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
9787                 }
9788                 case LDKCOption_OffersMessageZ_None: {
9789                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
9790                 }
9791                 default: abort();
9792         }
9793 }
9794 typedef struct LDKCustomOnionMessageContents_JCalls {
9795         atomic_size_t refcnt;
9796         JavaVM *vm;
9797         jweak o;
9798         jmethodID tlv_type_meth;
9799         jmethodID write_meth;
9800 } LDKCustomOnionMessageContents_JCalls;
9801 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
9802         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9803         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9804                 JNIEnv *env;
9805                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9806                 if (get_jenv_res == JNI_EDETACHED) {
9807                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9808                 } else {
9809                         DO_ASSERT(get_jenv_res == JNI_OK);
9810                 }
9811                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9812                 if (get_jenv_res == JNI_EDETACHED) {
9813                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9814                 }
9815                 FREE(j_calls);
9816         }
9817 }
9818 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9819         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9820         JNIEnv *env;
9821         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9822         if (get_jenv_res == JNI_EDETACHED) {
9823                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9824         } else {
9825                 DO_ASSERT(get_jenv_res == JNI_OK);
9826         }
9827         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9828         CHECK(obj != NULL);
9829         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
9830         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9831                 (*env)->ExceptionDescribe(env);
9832                 (*env)->FatalError(env, "A call to tlv_type in LDKCustomOnionMessageContents from rust threw an exception.");
9833         }
9834         if (get_jenv_res == JNI_EDETACHED) {
9835                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9836         }
9837         return ret;
9838 }
9839 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9840         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9841         JNIEnv *env;
9842         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9843         if (get_jenv_res == JNI_EDETACHED) {
9844                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9845         } else {
9846                 DO_ASSERT(get_jenv_res == JNI_OK);
9847         }
9848         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9849         CHECK(obj != NULL);
9850         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9851         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9852                 (*env)->ExceptionDescribe(env);
9853                 (*env)->FatalError(env, "A call to write in LDKCustomOnionMessageContents from rust threw an exception.");
9854         }
9855         LDKCVec_u8Z ret_ref;
9856         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9857         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9858         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9859         if (get_jenv_res == JNI_EDETACHED) {
9860                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9861         }
9862         return ret_ref;
9863 }
9864 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
9865         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
9866         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9867 }
9868 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
9869         jclass c = (*env)->GetObjectClass(env, o);
9870         CHECK(c != NULL);
9871         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
9872         atomic_init(&calls->refcnt, 1);
9873         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9874         calls->o = (*env)->NewWeakGlobalRef(env, o);
9875         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
9876         CHECK(calls->tlv_type_meth != NULL);
9877         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9878         CHECK(calls->write_meth != NULL);
9879
9880         LDKCustomOnionMessageContents ret = {
9881                 .this_arg = (void*) calls,
9882                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
9883                 .write = write_LDKCustomOnionMessageContents_jcall,
9884                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
9885                 .free = LDKCustomOnionMessageContents_JCalls_free,
9886         };
9887         return ret;
9888 }
9889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
9890         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9891         *res_ptr = LDKCustomOnionMessageContents_init(env, clz, o);
9892         return tag_ptr(res_ptr, true);
9893 }
9894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
9895         void* this_arg_ptr = untag_ptr(this_arg);
9896         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9897         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9898         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
9899         return ret_conv;
9900 }
9901
9902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9903         void* this_arg_ptr = untag_ptr(this_arg);
9904         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9905         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9906         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9907         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9908         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9909         CVec_u8Z_free(ret_var);
9910         return ret_arr;
9911 }
9912
9913 static jclass LDKCOption_CustomOnionMessageContentsZ_Some_class = NULL;
9914 static jmethodID LDKCOption_CustomOnionMessageContentsZ_Some_meth = NULL;
9915 static jclass LDKCOption_CustomOnionMessageContentsZ_None_class = NULL;
9916 static jmethodID LDKCOption_CustomOnionMessageContentsZ_None_meth = NULL;
9917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CustomOnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
9918         LDKCOption_CustomOnionMessageContentsZ_Some_class =
9919                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$Some"));
9920         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_class != NULL);
9921         LDKCOption_CustomOnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, "<init>", "(J)V");
9922         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_meth != NULL);
9923         LDKCOption_CustomOnionMessageContentsZ_None_class =
9924                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$None"));
9925         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_class != NULL);
9926         LDKCOption_CustomOnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_None_class, "<init>", "()V");
9927         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_meth != NULL);
9928 }
9929 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CustomOnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9930         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
9931         switch(obj->tag) {
9932                 case LDKCOption_CustomOnionMessageContentsZ_Some: {
9933                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9934                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
9935                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, LDKCOption_CustomOnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
9936                 }
9937                 case LDKCOption_CustomOnionMessageContentsZ_None: {
9938                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_None_class, LDKCOption_CustomOnionMessageContentsZ_None_meth);
9939                 }
9940                 default: abort();
9941         }
9942 }
9943 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9944 CHECK(owner->result_ok);
9945         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
9946 }
9947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9948         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9949         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
9950         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
9951         int64_t ret_ref = tag_ptr(ret_copy, true);
9952         return ret_ref;
9953 }
9954
9955 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9956 CHECK(!owner->result_ok);
9957         return DecodeError_clone(&*owner->contents.err);
9958 }
9959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9960         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9961         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9962         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
9963         int64_t ret_ref = tag_ptr(ret_copy, true);
9964         return ret_ref;
9965 }
9966
9967 static jclass LDKCOption_TypeZ_Some_class = NULL;
9968 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
9969 static jclass LDKCOption_TypeZ_None_class = NULL;
9970 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
9971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
9972         LDKCOption_TypeZ_Some_class =
9973                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
9974         CHECK(LDKCOption_TypeZ_Some_class != NULL);
9975         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
9976         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
9977         LDKCOption_TypeZ_None_class =
9978                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
9979         CHECK(LDKCOption_TypeZ_None_class != NULL);
9980         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
9981         CHECK(LDKCOption_TypeZ_None_meth != NULL);
9982 }
9983 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9984         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
9985         switch(obj->tag) {
9986                 case LDKCOption_TypeZ_Some: {
9987                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
9988                         *some_ret = Type_clone(&obj->some);
9989                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
9990                 }
9991                 case LDKCOption_TypeZ_None: {
9992                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
9993                 }
9994                 default: abort();
9995         }
9996 }
9997 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
9998 CHECK(owner->result_ok);
9999         return COption_TypeZ_clone(&*owner->contents.result);
10000 }
10001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10002         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
10003         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10004         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
10005         int64_t ret_ref = tag_ptr(ret_copy, true);
10006         return ret_ref;
10007 }
10008
10009 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
10010 CHECK(!owner->result_ok);
10011         return DecodeError_clone(&*owner->contents.err);
10012 }
10013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10014         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
10015         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10016         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
10017         int64_t ret_ref = tag_ptr(ret_copy, true);
10018         return ret_ref;
10019 }
10020
10021 static jclass LDKCOption_SocketAddressZ_Some_class = NULL;
10022 static jmethodID LDKCOption_SocketAddressZ_Some_meth = NULL;
10023 static jclass LDKCOption_SocketAddressZ_None_class = NULL;
10024 static jmethodID LDKCOption_SocketAddressZ_None_meth = NULL;
10025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SocketAddressZ_init (JNIEnv *env, jclass clz) {
10026         LDKCOption_SocketAddressZ_Some_class =
10027                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$Some"));
10028         CHECK(LDKCOption_SocketAddressZ_Some_class != NULL);
10029         LDKCOption_SocketAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_Some_class, "<init>", "(J)V");
10030         CHECK(LDKCOption_SocketAddressZ_Some_meth != NULL);
10031         LDKCOption_SocketAddressZ_None_class =
10032                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$None"));
10033         CHECK(LDKCOption_SocketAddressZ_None_class != NULL);
10034         LDKCOption_SocketAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_None_class, "<init>", "()V");
10035         CHECK(LDKCOption_SocketAddressZ_None_meth != NULL);
10036 }
10037 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SocketAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10038         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
10039         switch(obj->tag) {
10040                 case LDKCOption_SocketAddressZ_Some: {
10041                         int64_t some_ref = tag_ptr(&obj->some, false);
10042                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_Some_class, LDKCOption_SocketAddressZ_Some_meth, some_ref);
10043                 }
10044                 case LDKCOption_SocketAddressZ_None: {
10045                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_None_class, LDKCOption_SocketAddressZ_None_meth);
10046                 }
10047                 default: abort();
10048         }
10049 }
10050 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
10051         return owner->a;
10052 }
10053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10054         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
10055         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10056         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form);
10057         return ret_arr;
10058 }
10059
10060 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
10061         return COption_SocketAddressZ_clone(&owner->b);
10062 }
10063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10064         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
10065         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
10066         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
10067         int64_t ret_ref = tag_ptr(ret_copy, true);
10068         return ret_ref;
10069 }
10070
10071 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
10072         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
10073         for (size_t i = 0; i < ret.datalen; i++) {
10074                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
10075         }
10076         return ret;
10077 }
10078 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
10079 CHECK(owner->result_ok);
10080         return CVec_u8Z_clone(&*owner->contents.result);
10081 }
10082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10083         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
10084         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
10085         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10086         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10087         CVec_u8Z_free(ret_var);
10088         return ret_arr;
10089 }
10090
10091 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
10092         LDKPeerHandleError ret = *owner->contents.err;
10093         ret.is_owned = false;
10094         return ret;
10095 }
10096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10097         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
10098         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
10099         int64_t ret_ref = 0;
10100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10102         return ret_ref;
10103 }
10104
10105 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
10106 CHECK(owner->result_ok);
10107         return *owner->contents.result;
10108 }
10109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10110         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
10111         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
10112 }
10113
10114 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
10115         LDKPeerHandleError ret = *owner->contents.err;
10116         ret.is_owned = false;
10117         return ret;
10118 }
10119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10120         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
10121         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
10122         int64_t ret_ref = 0;
10123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10125         return ret_ref;
10126 }
10127
10128 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
10129 CHECK(owner->result_ok);
10130         return *owner->contents.result;
10131 }
10132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10133         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
10134         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
10135         return ret_conv;
10136 }
10137
10138 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
10139         LDKPeerHandleError ret = *owner->contents.err;
10140         ret.is_owned = false;
10141         return ret;
10142 }
10143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10144         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
10145         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
10146         int64_t ret_ref = 0;
10147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10149         return ret_ref;
10150 }
10151
10152 static jclass LDKGraphSyncError_DecodeError_class = NULL;
10153 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
10154 static jclass LDKGraphSyncError_LightningError_class = NULL;
10155 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
10156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
10157         LDKGraphSyncError_DecodeError_class =
10158                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
10159         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
10160         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
10161         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
10162         LDKGraphSyncError_LightningError_class =
10163                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
10164         CHECK(LDKGraphSyncError_LightningError_class != NULL);
10165         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
10166         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
10167 }
10168 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10169         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
10170         switch(obj->tag) {
10171                 case LDKGraphSyncError_DecodeError: {
10172                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
10173                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
10174                 }
10175                 case LDKGraphSyncError_LightningError: {
10176                         LDKLightningError lightning_error_var = obj->lightning_error;
10177                         int64_t lightning_error_ref = 0;
10178                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
10179                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
10180                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
10181                 }
10182                 default: abort();
10183         }
10184 }
10185 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10186 CHECK(owner->result_ok);
10187         return *owner->contents.result;
10188 }
10189 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10190         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10191         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
10192         return ret_conv;
10193 }
10194
10195 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10196 CHECK(!owner->result_ok);
10197         return GraphSyncError_clone(&*owner->contents.err);
10198 }
10199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10200         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10201         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
10202         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
10203         int64_t ret_ref = tag_ptr(ret_copy, true);
10204         return ret_ref;
10205 }
10206
10207 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
10208 CHECK(owner->result_ok);
10209         return CVec_u8Z_clone(&*owner->contents.result);
10210 }
10211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10212         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
10213         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
10214         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10215         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10216         CVec_u8Z_free(ret_var);
10217         return ret_arr;
10218 }
10219
10220 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
10221 CHECK(!owner->result_ok);
10222         return *owner->contents.err;
10223 }
10224 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10225         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
10226         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
10227         return ret_conv;
10228 }
10229
10230 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
10231 CHECK(owner->result_ok);
10232         return *owner->contents.result;
10233 }
10234 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10235         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
10236         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
10237         jobjectArray ret_arr = NULL;
10238         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
10239         ;
10240         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10241         for (size_t i = 0; i < ret_var.datalen; i++) {
10242                 LDKStr ret_conv_8_str = ret_var.data[i];
10243                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
10244                 ret_arr_ptr[i] = ret_conv_8_conv;
10245         }
10246         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10247         return ret_arr;
10248 }
10249
10250 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
10251 CHECK(!owner->result_ok);
10252         return *owner->contents.err;
10253 }
10254 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10255         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
10256         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
10257         return ret_conv;
10258 }
10259
10260 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
10261         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
10262         for (size_t i = 0; i < ret.datalen; i++) {
10263                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
10264         }
10265         return ret;
10266 }
10267 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
10268 CHECK(owner->result_ok);
10269         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
10270 }
10271 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10272         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
10273         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
10274         int64_tArray ret_arr = NULL;
10275         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10276         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10277         for (size_t o = 0; o < ret_var.datalen; o++) {
10278                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10279                 *ret_conv_40_conv = ret_var.data[o];
10280                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
10281         }
10282         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10283         FREE(ret_var.data);
10284         return ret_arr;
10285 }
10286
10287 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
10288 CHECK(!owner->result_ok);
10289         return *owner->contents.err;
10290 }
10291 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10292         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
10293         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
10294         return ret_conv;
10295 }
10296
10297 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
10298 CHECK(owner->result_ok);
10299         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
10300 }
10301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10302         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
10303         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10304         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
10305         return tag_ptr(ret_conv, true);
10306 }
10307
10308 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
10309 CHECK(!owner->result_ok);
10310         return *owner->contents.err;
10311 }
10312 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10313         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
10314         jclass ret_conv = LDKIOError_to_java(env, CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
10315         return ret_conv;
10316 }
10317
10318 static jclass LDKCOption_SecretKeyZ_Some_class = NULL;
10319 static jmethodID LDKCOption_SecretKeyZ_Some_meth = NULL;
10320 static jclass LDKCOption_SecretKeyZ_None_class = NULL;
10321 static jmethodID LDKCOption_SecretKeyZ_None_meth = NULL;
10322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SecretKeyZ_init (JNIEnv *env, jclass clz) {
10323         LDKCOption_SecretKeyZ_Some_class =
10324                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$Some"));
10325         CHECK(LDKCOption_SecretKeyZ_Some_class != NULL);
10326         LDKCOption_SecretKeyZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_Some_class, "<init>", "([B)V");
10327         CHECK(LDKCOption_SecretKeyZ_Some_meth != NULL);
10328         LDKCOption_SecretKeyZ_None_class =
10329                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$None"));
10330         CHECK(LDKCOption_SecretKeyZ_None_class != NULL);
10331         LDKCOption_SecretKeyZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_None_class, "<init>", "()V");
10332         CHECK(LDKCOption_SecretKeyZ_None_meth != NULL);
10333 }
10334 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SecretKeyZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10335         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
10336         switch(obj->tag) {
10337                 case LDKCOption_SecretKeyZ_Some: {
10338                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
10339                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
10340                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_Some_class, LDKCOption_SecretKeyZ_Some_meth, some_arr);
10341                 }
10342                 case LDKCOption_SecretKeyZ_None: {
10343                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_None_class, LDKCOption_SecretKeyZ_None_meth);
10344                 }
10345                 default: abort();
10346         }
10347 }
10348 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
10349         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
10350         ret.is_owned = false;
10351         return ret;
10352 }
10353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10354         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
10355         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
10356         int64_t ret_ref = 0;
10357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10359         return ret_ref;
10360 }
10361
10362 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
10363 CHECK(!owner->result_ok);
10364         return *owner->contents.err;
10365 }
10366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10367         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
10368         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
10369 }
10370
10371 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
10372         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
10373         for (size_t i = 0; i < ret.datalen; i++) {
10374                 ret.data[i] = Witness_clone(&orig->data[i]);
10375         }
10376         return ret;
10377 }
10378 static jclass LDKCOption_i64Z_Some_class = NULL;
10379 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
10380 static jclass LDKCOption_i64Z_None_class = NULL;
10381 static jmethodID LDKCOption_i64Z_None_meth = NULL;
10382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
10383         LDKCOption_i64Z_Some_class =
10384                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
10385         CHECK(LDKCOption_i64Z_Some_class != NULL);
10386         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
10387         CHECK(LDKCOption_i64Z_Some_meth != NULL);
10388         LDKCOption_i64Z_None_class =
10389                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
10390         CHECK(LDKCOption_i64Z_None_class != NULL);
10391         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
10392         CHECK(LDKCOption_i64Z_None_meth != NULL);
10393 }
10394 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10395         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
10396         switch(obj->tag) {
10397                 case LDKCOption_i64Z_Some: {
10398                         int64_t some_conv = obj->some;
10399                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
10400                 }
10401                 case LDKCOption_i64Z_None: {
10402                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
10403                 }
10404                 default: abort();
10405         }
10406 }
10407 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
10408 CHECK(owner->result_ok);
10409         return SocketAddress_clone(&*owner->contents.result);
10410 }
10411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10412         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
10413         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10414         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
10415         int64_t ret_ref = tag_ptr(ret_copy, true);
10416         return ret_ref;
10417 }
10418
10419 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
10420 CHECK(!owner->result_ok);
10421         return DecodeError_clone(&*owner->contents.err);
10422 }
10423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10424         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
10425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10426         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
10427         int64_t ret_ref = tag_ptr(ret_copy, true);
10428         return ret_ref;
10429 }
10430
10431 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
10432 CHECK(owner->result_ok);
10433         return SocketAddress_clone(&*owner->contents.result);
10434 }
10435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10436         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
10437         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10438         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
10439         int64_t ret_ref = tag_ptr(ret_copy, true);
10440         return ret_ref;
10441 }
10442
10443 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
10444 CHECK(!owner->result_ok);
10445         return SocketAddressParseError_clone(&*owner->contents.err);
10446 }
10447 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10448         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
10449         jclass ret_conv = LDKSocketAddressParseError_to_java(env, CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
10450         return ret_conv;
10451 }
10452
10453 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
10454         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
10455         for (size_t i = 0; i < ret.datalen; i++) {
10456                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
10457         }
10458         return ret;
10459 }
10460 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
10461         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
10462         for (size_t i = 0; i < ret.datalen; i++) {
10463                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
10464         }
10465         return ret;
10466 }
10467 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
10468         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
10469         for (size_t i = 0; i < ret.datalen; i++) {
10470                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
10471         }
10472         return ret;
10473 }
10474 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
10475         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
10476         for (size_t i = 0; i < ret.datalen; i++) {
10477                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
10478         }
10479         return ret;
10480 }
10481 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10482         LDKAcceptChannel ret = *owner->contents.result;
10483         ret.is_owned = false;
10484         return ret;
10485 }
10486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10487         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10488         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
10489         int64_t ret_ref = 0;
10490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10492         return ret_ref;
10493 }
10494
10495 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10496 CHECK(!owner->result_ok);
10497         return DecodeError_clone(&*owner->contents.err);
10498 }
10499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10500         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10501         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10502         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
10503         int64_t ret_ref = tag_ptr(ret_copy, true);
10504         return ret_ref;
10505 }
10506
10507 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10508         LDKAcceptChannelV2 ret = *owner->contents.result;
10509         ret.is_owned = false;
10510         return ret;
10511 }
10512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10513         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10514         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
10515         int64_t ret_ref = 0;
10516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10518         return ret_ref;
10519 }
10520
10521 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10522 CHECK(!owner->result_ok);
10523         return DecodeError_clone(&*owner->contents.err);
10524 }
10525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10526         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10527         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10528         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
10529         int64_t ret_ref = tag_ptr(ret_copy, true);
10530         return ret_ref;
10531 }
10532
10533 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10534         LDKTxAddInput ret = *owner->contents.result;
10535         ret.is_owned = false;
10536         return ret;
10537 }
10538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10539         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10540         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
10541         int64_t ret_ref = 0;
10542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10544         return ret_ref;
10545 }
10546
10547 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10548 CHECK(!owner->result_ok);
10549         return DecodeError_clone(&*owner->contents.err);
10550 }
10551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10552         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10553         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10554         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
10555         int64_t ret_ref = tag_ptr(ret_copy, true);
10556         return ret_ref;
10557 }
10558
10559 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10560         LDKTxAddOutput ret = *owner->contents.result;
10561         ret.is_owned = false;
10562         return ret;
10563 }
10564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10565         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10566         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
10567         int64_t ret_ref = 0;
10568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10570         return ret_ref;
10571 }
10572
10573 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10574 CHECK(!owner->result_ok);
10575         return DecodeError_clone(&*owner->contents.err);
10576 }
10577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10578         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10579         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10580         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
10581         int64_t ret_ref = tag_ptr(ret_copy, true);
10582         return ret_ref;
10583 }
10584
10585 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10586         LDKTxRemoveInput ret = *owner->contents.result;
10587         ret.is_owned = false;
10588         return ret;
10589 }
10590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10591         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10592         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
10593         int64_t ret_ref = 0;
10594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10596         return ret_ref;
10597 }
10598
10599 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10600 CHECK(!owner->result_ok);
10601         return DecodeError_clone(&*owner->contents.err);
10602 }
10603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10604         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10605         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10606         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
10607         int64_t ret_ref = tag_ptr(ret_copy, true);
10608         return ret_ref;
10609 }
10610
10611 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10612         LDKTxRemoveOutput ret = *owner->contents.result;
10613         ret.is_owned = false;
10614         return ret;
10615 }
10616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10617         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10618         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
10619         int64_t ret_ref = 0;
10620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10622         return ret_ref;
10623 }
10624
10625 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10626 CHECK(!owner->result_ok);
10627         return DecodeError_clone(&*owner->contents.err);
10628 }
10629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10630         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10631         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10632         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
10633         int64_t ret_ref = tag_ptr(ret_copy, true);
10634         return ret_ref;
10635 }
10636
10637 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10638         LDKTxComplete ret = *owner->contents.result;
10639         ret.is_owned = false;
10640         return ret;
10641 }
10642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10643         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10644         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
10645         int64_t ret_ref = 0;
10646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10648         return ret_ref;
10649 }
10650
10651 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10652 CHECK(!owner->result_ok);
10653         return DecodeError_clone(&*owner->contents.err);
10654 }
10655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10656         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10657         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10658         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
10659         int64_t ret_ref = tag_ptr(ret_copy, true);
10660         return ret_ref;
10661 }
10662
10663 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10664         LDKTxSignatures ret = *owner->contents.result;
10665         ret.is_owned = false;
10666         return ret;
10667 }
10668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10669         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10670         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
10671         int64_t ret_ref = 0;
10672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10674         return ret_ref;
10675 }
10676
10677 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10678 CHECK(!owner->result_ok);
10679         return DecodeError_clone(&*owner->contents.err);
10680 }
10681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10682         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10683         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10684         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
10685         int64_t ret_ref = tag_ptr(ret_copy, true);
10686         return ret_ref;
10687 }
10688
10689 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10690         LDKTxInitRbf ret = *owner->contents.result;
10691         ret.is_owned = false;
10692         return ret;
10693 }
10694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10695         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10696         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
10697         int64_t ret_ref = 0;
10698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10700         return ret_ref;
10701 }
10702
10703 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10704 CHECK(!owner->result_ok);
10705         return DecodeError_clone(&*owner->contents.err);
10706 }
10707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10708         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10709         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10710         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
10711         int64_t ret_ref = tag_ptr(ret_copy, true);
10712         return ret_ref;
10713 }
10714
10715 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10716         LDKTxAckRbf ret = *owner->contents.result;
10717         ret.is_owned = false;
10718         return ret;
10719 }
10720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10721         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10722         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
10723         int64_t ret_ref = 0;
10724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10726         return ret_ref;
10727 }
10728
10729 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10730 CHECK(!owner->result_ok);
10731         return DecodeError_clone(&*owner->contents.err);
10732 }
10733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10734         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10735         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10736         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
10737         int64_t ret_ref = tag_ptr(ret_copy, true);
10738         return ret_ref;
10739 }
10740
10741 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10742         LDKTxAbort ret = *owner->contents.result;
10743         ret.is_owned = false;
10744         return ret;
10745 }
10746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10747         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10748         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
10749         int64_t ret_ref = 0;
10750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10752         return ret_ref;
10753 }
10754
10755 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10756 CHECK(!owner->result_ok);
10757         return DecodeError_clone(&*owner->contents.err);
10758 }
10759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10760         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10761         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10762         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
10763         int64_t ret_ref = tag_ptr(ret_copy, true);
10764         return ret_ref;
10765 }
10766
10767 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10768         LDKAnnouncementSignatures ret = *owner->contents.result;
10769         ret.is_owned = false;
10770         return ret;
10771 }
10772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10773         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10774         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
10775         int64_t ret_ref = 0;
10776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10778         return ret_ref;
10779 }
10780
10781 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10782 CHECK(!owner->result_ok);
10783         return DecodeError_clone(&*owner->contents.err);
10784 }
10785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10786         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10787         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10788         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
10789         int64_t ret_ref = tag_ptr(ret_copy, true);
10790         return ret_ref;
10791 }
10792
10793 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10794         LDKChannelReestablish ret = *owner->contents.result;
10795         ret.is_owned = false;
10796         return ret;
10797 }
10798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10799         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10800         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
10801         int64_t ret_ref = 0;
10802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10804         return ret_ref;
10805 }
10806
10807 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10808 CHECK(!owner->result_ok);
10809         return DecodeError_clone(&*owner->contents.err);
10810 }
10811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10812         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10813         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10814         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
10815         int64_t ret_ref = tag_ptr(ret_copy, true);
10816         return ret_ref;
10817 }
10818
10819 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10820         LDKClosingSigned ret = *owner->contents.result;
10821         ret.is_owned = false;
10822         return ret;
10823 }
10824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10825         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10826         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
10827         int64_t ret_ref = 0;
10828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10830         return ret_ref;
10831 }
10832
10833 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10834 CHECK(!owner->result_ok);
10835         return DecodeError_clone(&*owner->contents.err);
10836 }
10837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10838         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10839         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10840         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
10841         int64_t ret_ref = tag_ptr(ret_copy, true);
10842         return ret_ref;
10843 }
10844
10845 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10846         LDKClosingSignedFeeRange ret = *owner->contents.result;
10847         ret.is_owned = false;
10848         return ret;
10849 }
10850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10851         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10852         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
10853         int64_t ret_ref = 0;
10854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10856         return ret_ref;
10857 }
10858
10859 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10860 CHECK(!owner->result_ok);
10861         return DecodeError_clone(&*owner->contents.err);
10862 }
10863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10864         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10865         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10866         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
10867         int64_t ret_ref = tag_ptr(ret_copy, true);
10868         return ret_ref;
10869 }
10870
10871 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10872         LDKCommitmentSigned ret = *owner->contents.result;
10873         ret.is_owned = false;
10874         return ret;
10875 }
10876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10877         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10878         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
10879         int64_t ret_ref = 0;
10880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10882         return ret_ref;
10883 }
10884
10885 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10886 CHECK(!owner->result_ok);
10887         return DecodeError_clone(&*owner->contents.err);
10888 }
10889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10890         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10891         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10892         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
10893         int64_t ret_ref = tag_ptr(ret_copy, true);
10894         return ret_ref;
10895 }
10896
10897 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10898         LDKFundingCreated ret = *owner->contents.result;
10899         ret.is_owned = false;
10900         return ret;
10901 }
10902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10903         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10904         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
10905         int64_t ret_ref = 0;
10906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10908         return ret_ref;
10909 }
10910
10911 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10912 CHECK(!owner->result_ok);
10913         return DecodeError_clone(&*owner->contents.err);
10914 }
10915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10916         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10917         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10918         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
10919         int64_t ret_ref = tag_ptr(ret_copy, true);
10920         return ret_ref;
10921 }
10922
10923 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10924         LDKFundingSigned ret = *owner->contents.result;
10925         ret.is_owned = false;
10926         return ret;
10927 }
10928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10929         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10930         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
10931         int64_t ret_ref = 0;
10932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10934         return ret_ref;
10935 }
10936
10937 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10938 CHECK(!owner->result_ok);
10939         return DecodeError_clone(&*owner->contents.err);
10940 }
10941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10942         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10943         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10944         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
10945         int64_t ret_ref = tag_ptr(ret_copy, true);
10946         return ret_ref;
10947 }
10948
10949 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10950         LDKChannelReady ret = *owner->contents.result;
10951         ret.is_owned = false;
10952         return ret;
10953 }
10954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10955         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10956         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
10957         int64_t ret_ref = 0;
10958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10960         return ret_ref;
10961 }
10962
10963 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10964 CHECK(!owner->result_ok);
10965         return DecodeError_clone(&*owner->contents.err);
10966 }
10967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10968         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10969         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10970         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
10971         int64_t ret_ref = tag_ptr(ret_copy, true);
10972         return ret_ref;
10973 }
10974
10975 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10976         LDKInit ret = *owner->contents.result;
10977         ret.is_owned = false;
10978         return ret;
10979 }
10980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10981         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10982         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
10983         int64_t ret_ref = 0;
10984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10986         return ret_ref;
10987 }
10988
10989 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10990 CHECK(!owner->result_ok);
10991         return DecodeError_clone(&*owner->contents.err);
10992 }
10993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10994         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10995         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10996         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
10997         int64_t ret_ref = tag_ptr(ret_copy, true);
10998         return ret_ref;
10999 }
11000
11001 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
11002         LDKOpenChannel ret = *owner->contents.result;
11003         ret.is_owned = false;
11004         return ret;
11005 }
11006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11007         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
11008         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
11009         int64_t ret_ref = 0;
11010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11012         return ret_ref;
11013 }
11014
11015 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
11016 CHECK(!owner->result_ok);
11017         return DecodeError_clone(&*owner->contents.err);
11018 }
11019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11020         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
11021         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11022         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
11023         int64_t ret_ref = tag_ptr(ret_copy, true);
11024         return ret_ref;
11025 }
11026
11027 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
11028         LDKOpenChannelV2 ret = *owner->contents.result;
11029         ret.is_owned = false;
11030         return ret;
11031 }
11032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11033         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
11034         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
11035         int64_t ret_ref = 0;
11036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11038         return ret_ref;
11039 }
11040
11041 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
11042 CHECK(!owner->result_ok);
11043         return DecodeError_clone(&*owner->contents.err);
11044 }
11045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11046         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
11047         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11048         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
11049         int64_t ret_ref = tag_ptr(ret_copy, true);
11050         return ret_ref;
11051 }
11052
11053 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
11054         LDKRevokeAndACK ret = *owner->contents.result;
11055         ret.is_owned = false;
11056         return ret;
11057 }
11058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11059         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
11060         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
11061         int64_t ret_ref = 0;
11062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11064         return ret_ref;
11065 }
11066
11067 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
11068 CHECK(!owner->result_ok);
11069         return DecodeError_clone(&*owner->contents.err);
11070 }
11071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11072         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
11073         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11074         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
11075         int64_t ret_ref = tag_ptr(ret_copy, true);
11076         return ret_ref;
11077 }
11078
11079 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
11080         LDKShutdown ret = *owner->contents.result;
11081         ret.is_owned = false;
11082         return ret;
11083 }
11084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11085         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
11086         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
11087         int64_t ret_ref = 0;
11088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11090         return ret_ref;
11091 }
11092
11093 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
11094 CHECK(!owner->result_ok);
11095         return DecodeError_clone(&*owner->contents.err);
11096 }
11097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11098         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
11099         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11100         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
11101         int64_t ret_ref = tag_ptr(ret_copy, true);
11102         return ret_ref;
11103 }
11104
11105 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
11106         LDKUpdateFailHTLC ret = *owner->contents.result;
11107         ret.is_owned = false;
11108         return ret;
11109 }
11110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11111         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
11112         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
11113         int64_t ret_ref = 0;
11114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11116         return ret_ref;
11117 }
11118
11119 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
11120 CHECK(!owner->result_ok);
11121         return DecodeError_clone(&*owner->contents.err);
11122 }
11123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11124         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
11125         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11126         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
11127         int64_t ret_ref = tag_ptr(ret_copy, true);
11128         return ret_ref;
11129 }
11130
11131 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
11132         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
11133         ret.is_owned = false;
11134         return ret;
11135 }
11136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11137         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
11138         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
11139         int64_t ret_ref = 0;
11140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11142         return ret_ref;
11143 }
11144
11145 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
11146 CHECK(!owner->result_ok);
11147         return DecodeError_clone(&*owner->contents.err);
11148 }
11149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11150         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
11151         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11152         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
11153         int64_t ret_ref = tag_ptr(ret_copy, true);
11154         return ret_ref;
11155 }
11156
11157 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
11158         LDKUpdateFee ret = *owner->contents.result;
11159         ret.is_owned = false;
11160         return ret;
11161 }
11162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11163         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
11164         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
11165         int64_t ret_ref = 0;
11166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11168         return ret_ref;
11169 }
11170
11171 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
11172 CHECK(!owner->result_ok);
11173         return DecodeError_clone(&*owner->contents.err);
11174 }
11175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11176         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
11177         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11178         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
11179         int64_t ret_ref = tag_ptr(ret_copy, true);
11180         return ret_ref;
11181 }
11182
11183 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
11184         LDKUpdateFulfillHTLC ret = *owner->contents.result;
11185         ret.is_owned = false;
11186         return ret;
11187 }
11188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11189         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
11190         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
11191         int64_t ret_ref = 0;
11192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11194         return ret_ref;
11195 }
11196
11197 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
11198 CHECK(!owner->result_ok);
11199         return DecodeError_clone(&*owner->contents.err);
11200 }
11201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11202         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
11203         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11204         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
11205         int64_t ret_ref = tag_ptr(ret_copy, true);
11206         return ret_ref;
11207 }
11208
11209 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
11210         LDKUpdateAddHTLC ret = *owner->contents.result;
11211         ret.is_owned = false;
11212         return ret;
11213 }
11214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11215         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
11216         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
11217         int64_t ret_ref = 0;
11218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11220         return ret_ref;
11221 }
11222
11223 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
11224 CHECK(!owner->result_ok);
11225         return DecodeError_clone(&*owner->contents.err);
11226 }
11227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11228         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
11229         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11230         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
11231         int64_t ret_ref = tag_ptr(ret_copy, true);
11232         return ret_ref;
11233 }
11234
11235 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
11236         LDKOnionMessage ret = *owner->contents.result;
11237         ret.is_owned = false;
11238         return ret;
11239 }
11240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11241         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
11242         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
11243         int64_t ret_ref = 0;
11244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11246         return ret_ref;
11247 }
11248
11249 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
11250 CHECK(!owner->result_ok);
11251         return DecodeError_clone(&*owner->contents.err);
11252 }
11253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11254         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
11255         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11256         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
11257         int64_t ret_ref = tag_ptr(ret_copy, true);
11258         return ret_ref;
11259 }
11260
11261 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11262         LDKPing ret = *owner->contents.result;
11263         ret.is_owned = false;
11264         return ret;
11265 }
11266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11267         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11268         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
11269         int64_t ret_ref = 0;
11270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11272         return ret_ref;
11273 }
11274
11275 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11276 CHECK(!owner->result_ok);
11277         return DecodeError_clone(&*owner->contents.err);
11278 }
11279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11280         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11281         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11282         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
11283         int64_t ret_ref = tag_ptr(ret_copy, true);
11284         return ret_ref;
11285 }
11286
11287 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11288         LDKPong ret = *owner->contents.result;
11289         ret.is_owned = false;
11290         return ret;
11291 }
11292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11293         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11294         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
11295         int64_t ret_ref = 0;
11296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11298         return ret_ref;
11299 }
11300
11301 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11302 CHECK(!owner->result_ok);
11303         return DecodeError_clone(&*owner->contents.err);
11304 }
11305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11306         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11307         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11308         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
11309         int64_t ret_ref = tag_ptr(ret_copy, true);
11310         return ret_ref;
11311 }
11312
11313 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11314         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
11315         ret.is_owned = false;
11316         return ret;
11317 }
11318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11319         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11320         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11321         int64_t ret_ref = 0;
11322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11324         return ret_ref;
11325 }
11326
11327 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11328 CHECK(!owner->result_ok);
11329         return DecodeError_clone(&*owner->contents.err);
11330 }
11331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11332         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11333         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11334         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11335         int64_t ret_ref = tag_ptr(ret_copy, true);
11336         return ret_ref;
11337 }
11338
11339 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11340         LDKChannelAnnouncement ret = *owner->contents.result;
11341         ret.is_owned = false;
11342         return ret;
11343 }
11344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11345         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11346         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11347         int64_t ret_ref = 0;
11348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11350         return ret_ref;
11351 }
11352
11353 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11354 CHECK(!owner->result_ok);
11355         return DecodeError_clone(&*owner->contents.err);
11356 }
11357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11358         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11359         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11360         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11361         int64_t ret_ref = tag_ptr(ret_copy, true);
11362         return ret_ref;
11363 }
11364
11365 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11366         LDKUnsignedChannelUpdate ret = *owner->contents.result;
11367         ret.is_owned = false;
11368         return ret;
11369 }
11370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11371         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11372         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11373         int64_t ret_ref = 0;
11374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11376         return ret_ref;
11377 }
11378
11379 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11380 CHECK(!owner->result_ok);
11381         return DecodeError_clone(&*owner->contents.err);
11382 }
11383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11384         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11385         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11386         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
11387         int64_t ret_ref = tag_ptr(ret_copy, true);
11388         return ret_ref;
11389 }
11390
11391 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11392         LDKChannelUpdate ret = *owner->contents.result;
11393         ret.is_owned = false;
11394         return ret;
11395 }
11396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11397         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11398         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11399         int64_t ret_ref = 0;
11400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11402         return ret_ref;
11403 }
11404
11405 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11406 CHECK(!owner->result_ok);
11407         return DecodeError_clone(&*owner->contents.err);
11408 }
11409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11410         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11411         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11412         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
11413         int64_t ret_ref = tag_ptr(ret_copy, true);
11414         return ret_ref;
11415 }
11416
11417 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11418         LDKErrorMessage ret = *owner->contents.result;
11419         ret.is_owned = false;
11420         return ret;
11421 }
11422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11423         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11424         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
11425         int64_t ret_ref = 0;
11426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11428         return ret_ref;
11429 }
11430
11431 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11432 CHECK(!owner->result_ok);
11433         return DecodeError_clone(&*owner->contents.err);
11434 }
11435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11436         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11437         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11438         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
11439         int64_t ret_ref = tag_ptr(ret_copy, true);
11440         return ret_ref;
11441 }
11442
11443 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11444         LDKWarningMessage ret = *owner->contents.result;
11445         ret.is_owned = false;
11446         return ret;
11447 }
11448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11449         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11450         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
11451         int64_t ret_ref = 0;
11452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11454         return ret_ref;
11455 }
11456
11457 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11458 CHECK(!owner->result_ok);
11459         return DecodeError_clone(&*owner->contents.err);
11460 }
11461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11462         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11463         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11464         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
11465         int64_t ret_ref = tag_ptr(ret_copy, true);
11466         return ret_ref;
11467 }
11468
11469 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11470         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
11471         ret.is_owned = false;
11472         return ret;
11473 }
11474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11475         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11476         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11477         int64_t ret_ref = 0;
11478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11480         return ret_ref;
11481 }
11482
11483 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11484 CHECK(!owner->result_ok);
11485         return DecodeError_clone(&*owner->contents.err);
11486 }
11487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11488         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11489         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11490         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11491         int64_t ret_ref = tag_ptr(ret_copy, true);
11492         return ret_ref;
11493 }
11494
11495 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11496         LDKNodeAnnouncement ret = *owner->contents.result;
11497         ret.is_owned = false;
11498         return ret;
11499 }
11500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11501         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11502         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11503         int64_t ret_ref = 0;
11504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11506         return ret_ref;
11507 }
11508
11509 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11510 CHECK(!owner->result_ok);
11511         return DecodeError_clone(&*owner->contents.err);
11512 }
11513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11514         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11515         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11516         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11517         int64_t ret_ref = tag_ptr(ret_copy, true);
11518         return ret_ref;
11519 }
11520
11521 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11522         LDKQueryShortChannelIds ret = *owner->contents.result;
11523         ret.is_owned = false;
11524         return ret;
11525 }
11526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11527         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11528         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
11529         int64_t ret_ref = 0;
11530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11532         return ret_ref;
11533 }
11534
11535 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11536 CHECK(!owner->result_ok);
11537         return DecodeError_clone(&*owner->contents.err);
11538 }
11539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11540         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11541         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11542         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
11543         int64_t ret_ref = tag_ptr(ret_copy, true);
11544         return ret_ref;
11545 }
11546
11547 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11548         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
11549         ret.is_owned = false;
11550         return ret;
11551 }
11552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11553         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11554         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
11555         int64_t ret_ref = 0;
11556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11558         return ret_ref;
11559 }
11560
11561 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11562 CHECK(!owner->result_ok);
11563         return DecodeError_clone(&*owner->contents.err);
11564 }
11565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11566         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11567         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11568         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
11569         int64_t ret_ref = tag_ptr(ret_copy, true);
11570         return ret_ref;
11571 }
11572
11573 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11574         LDKQueryChannelRange ret = *owner->contents.result;
11575         ret.is_owned = false;
11576         return ret;
11577 }
11578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11579         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11580         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
11581         int64_t ret_ref = 0;
11582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11584         return ret_ref;
11585 }
11586
11587 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11588 CHECK(!owner->result_ok);
11589         return DecodeError_clone(&*owner->contents.err);
11590 }
11591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11592         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11593         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11594         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
11595         int64_t ret_ref = tag_ptr(ret_copy, true);
11596         return ret_ref;
11597 }
11598
11599 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11600         LDKReplyChannelRange ret = *owner->contents.result;
11601         ret.is_owned = false;
11602         return ret;
11603 }
11604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11605         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11606         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
11607         int64_t ret_ref = 0;
11608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11610         return ret_ref;
11611 }
11612
11613 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11614 CHECK(!owner->result_ok);
11615         return DecodeError_clone(&*owner->contents.err);
11616 }
11617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11618         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11619         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11620         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
11621         int64_t ret_ref = tag_ptr(ret_copy, true);
11622         return ret_ref;
11623 }
11624
11625 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11626         LDKGossipTimestampFilter ret = *owner->contents.result;
11627         ret.is_owned = false;
11628         return ret;
11629 }
11630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11631         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11632         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
11633         int64_t ret_ref = 0;
11634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11636         return ret_ref;
11637 }
11638
11639 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11640 CHECK(!owner->result_ok);
11641         return DecodeError_clone(&*owner->contents.err);
11642 }
11643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11644         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11645         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11646         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
11647         int64_t ret_ref = tag_ptr(ret_copy, true);
11648         return ret_ref;
11649 }
11650
11651 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
11652         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
11653         for (size_t i = 0; i < ret.datalen; i++) {
11654                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
11655         }
11656         return ret;
11657 }
11658 static jclass LDKSignOrCreationError_SignError_class = NULL;
11659 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
11660 static jclass LDKSignOrCreationError_CreationError_class = NULL;
11661 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
11662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
11663         LDKSignOrCreationError_SignError_class =
11664                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
11665         CHECK(LDKSignOrCreationError_SignError_class != NULL);
11666         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
11667         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
11668         LDKSignOrCreationError_CreationError_class =
11669                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
11670         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
11671         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
11672         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
11673 }
11674 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11675         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
11676         switch(obj->tag) {
11677                 case LDKSignOrCreationError_SignError: {
11678                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
11679                 }
11680                 case LDKSignOrCreationError_CreationError: {
11681                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
11682                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
11683                 }
11684                 default: abort();
11685         }
11686 }
11687 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11688         LDKBolt11Invoice ret = *owner->contents.result;
11689         ret.is_owned = false;
11690         return ret;
11691 }
11692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11693         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11694         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
11695         int64_t ret_ref = 0;
11696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11698         return ret_ref;
11699 }
11700
11701 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11702 CHECK(!owner->result_ok);
11703         return SignOrCreationError_clone(&*owner->contents.err);
11704 }
11705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11706         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11707         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
11708         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
11709         int64_t ret_ref = tag_ptr(ret_copy, true);
11710         return ret_ref;
11711 }
11712
11713 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
11714         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
11715         for (size_t i = 0; i < ret.datalen; i++) {
11716                 ret.data[i] = Future_clone(&orig->data[i]);
11717         }
11718         return ret;
11719 }
11720 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11721 CHECK(owner->result_ok);
11722         return OffersMessage_clone(&*owner->contents.result);
11723 }
11724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11725         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11726         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
11727         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
11728         int64_t ret_ref = tag_ptr(ret_copy, true);
11729         return ret_ref;
11730 }
11731
11732 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11733 CHECK(!owner->result_ok);
11734         return DecodeError_clone(&*owner->contents.err);
11735 }
11736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11737         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11738         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11739         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
11740         int64_t ret_ref = tag_ptr(ret_copy, true);
11741         return ret_ref;
11742 }
11743
11744 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
11745 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
11746 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
11747 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
11748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
11749         LDKCOption_HTLCClaimZ_Some_class =
11750                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
11751         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
11752         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
11753         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
11754         LDKCOption_HTLCClaimZ_None_class =
11755                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
11756         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
11757         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
11758         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
11759 }
11760 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11761         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
11762         switch(obj->tag) {
11763                 case LDKCOption_HTLCClaimZ_Some: {
11764                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
11765                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
11766                 }
11767                 case LDKCOption_HTLCClaimZ_None: {
11768                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
11769                 }
11770                 default: abort();
11771         }
11772 }
11773 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11774         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
11775         ret.is_owned = false;
11776         return ret;
11777 }
11778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11779         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11780         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
11781         int64_t ret_ref = 0;
11782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11784         return ret_ref;
11785 }
11786
11787 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11788 CHECK(!owner->result_ok);
11789         return DecodeError_clone(&*owner->contents.err);
11790 }
11791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11792         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11793         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11794         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
11795         int64_t ret_ref = tag_ptr(ret_copy, true);
11796         return ret_ref;
11797 }
11798
11799 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11800         LDKTxCreationKeys ret = *owner->contents.result;
11801         ret.is_owned = false;
11802         return ret;
11803 }
11804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11805         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11806         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
11807         int64_t ret_ref = 0;
11808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11810         return ret_ref;
11811 }
11812
11813 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11814 CHECK(!owner->result_ok);
11815         return DecodeError_clone(&*owner->contents.err);
11816 }
11817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11818         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11819         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11820         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
11821         int64_t ret_ref = tag_ptr(ret_copy, true);
11822         return ret_ref;
11823 }
11824
11825 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11826         LDKChannelPublicKeys ret = *owner->contents.result;
11827         ret.is_owned = false;
11828         return ret;
11829 }
11830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11831         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11832         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
11833         int64_t ret_ref = 0;
11834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11836         return ret_ref;
11837 }
11838
11839 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11840 CHECK(!owner->result_ok);
11841         return DecodeError_clone(&*owner->contents.err);
11842 }
11843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11844         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11845         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11846         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
11847         int64_t ret_ref = tag_ptr(ret_copy, true);
11848         return ret_ref;
11849 }
11850
11851 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11852         LDKHTLCOutputInCommitment ret = *owner->contents.result;
11853         ret.is_owned = false;
11854         return ret;
11855 }
11856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11857         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11858         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
11859         int64_t ret_ref = 0;
11860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11862         return ret_ref;
11863 }
11864
11865 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11866 CHECK(!owner->result_ok);
11867         return DecodeError_clone(&*owner->contents.err);
11868 }
11869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11870         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11871         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11872         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
11873         int64_t ret_ref = tag_ptr(ret_copy, true);
11874         return ret_ref;
11875 }
11876
11877 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11878         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
11879         ret.is_owned = false;
11880         return ret;
11881 }
11882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11883         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11884         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11885         int64_t ret_ref = 0;
11886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11888         return ret_ref;
11889 }
11890
11891 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11892 CHECK(!owner->result_ok);
11893         return DecodeError_clone(&*owner->contents.err);
11894 }
11895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11896         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11897         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11898         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11899         int64_t ret_ref = tag_ptr(ret_copy, true);
11900         return ret_ref;
11901 }
11902
11903 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11904         LDKChannelTransactionParameters ret = *owner->contents.result;
11905         ret.is_owned = false;
11906         return ret;
11907 }
11908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11909         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11910         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11911         int64_t ret_ref = 0;
11912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11914         return ret_ref;
11915 }
11916
11917 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11918 CHECK(!owner->result_ok);
11919         return DecodeError_clone(&*owner->contents.err);
11920 }
11921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11922         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11923         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11924         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11925         int64_t ret_ref = tag_ptr(ret_copy, true);
11926         return ret_ref;
11927 }
11928
11929 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11930         LDKHolderCommitmentTransaction ret = *owner->contents.result;
11931         ret.is_owned = false;
11932         return ret;
11933 }
11934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11935         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11936         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11937         int64_t ret_ref = 0;
11938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11940         return ret_ref;
11941 }
11942
11943 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11944 CHECK(!owner->result_ok);
11945         return DecodeError_clone(&*owner->contents.err);
11946 }
11947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11948         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11949         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11950         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11951         int64_t ret_ref = tag_ptr(ret_copy, true);
11952         return ret_ref;
11953 }
11954
11955 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11956         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
11957         ret.is_owned = false;
11958         return ret;
11959 }
11960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11961         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11962         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11963         int64_t ret_ref = 0;
11964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11966         return ret_ref;
11967 }
11968
11969 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11970 CHECK(!owner->result_ok);
11971         return DecodeError_clone(&*owner->contents.err);
11972 }
11973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11974         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11975         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11976         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11977         int64_t ret_ref = tag_ptr(ret_copy, true);
11978         return ret_ref;
11979 }
11980
11981 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11982         LDKTrustedClosingTransaction ret = *owner->contents.result;
11983         ret.is_owned = false;
11984         return ret;
11985 }
11986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11987         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11988         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
11989         int64_t ret_ref = 0;
11990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11992         return ret_ref;
11993 }
11994
11995 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11996 CHECK(!owner->result_ok);
11997         return *owner->contents.err;
11998 }
11999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12000         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
12001         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
12002 }
12003
12004 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12005         LDKCommitmentTransaction ret = *owner->contents.result;
12006         ret.is_owned = false;
12007         return ret;
12008 }
12009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12010         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12011         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
12012         int64_t ret_ref = 0;
12013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12015         return ret_ref;
12016 }
12017
12018 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12019 CHECK(!owner->result_ok);
12020         return DecodeError_clone(&*owner->contents.err);
12021 }
12022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12023         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12024         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12025         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
12026         int64_t ret_ref = tag_ptr(ret_copy, true);
12027         return ret_ref;
12028 }
12029
12030 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
12031         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
12032         ret.is_owned = false;
12033         return ret;
12034 }
12035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12036         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
12037         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
12038         int64_t ret_ref = 0;
12039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12041         return ret_ref;
12042 }
12043
12044 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
12045 CHECK(!owner->result_ok);
12046         return *owner->contents.err;
12047 }
12048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12049         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
12050         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
12051 }
12052
12053 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
12054 CHECK(owner->result_ok);
12055         return *owner->contents.result;
12056 }
12057 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12058         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
12059         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
12060         jobjectArray ret_arr = NULL;
12061         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
12062         ;
12063         for (size_t i = 0; i < ret_var.datalen; i++) {
12064                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
12065                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
12066                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
12067         }
12068         
12069         return ret_arr;
12070 }
12071
12072 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
12073 CHECK(!owner->result_ok);
12074         return *owner->contents.err;
12075 }
12076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12077         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
12078         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
12079 }
12080
12081 static jclass LDKCOption_usizeZ_Some_class = NULL;
12082 static jmethodID LDKCOption_usizeZ_Some_meth = NULL;
12083 static jclass LDKCOption_usizeZ_None_class = NULL;
12084 static jmethodID LDKCOption_usizeZ_None_meth = NULL;
12085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1usizeZ_init (JNIEnv *env, jclass clz) {
12086         LDKCOption_usizeZ_Some_class =
12087                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$Some"));
12088         CHECK(LDKCOption_usizeZ_Some_class != NULL);
12089         LDKCOption_usizeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_Some_class, "<init>", "(J)V");
12090         CHECK(LDKCOption_usizeZ_Some_meth != NULL);
12091         LDKCOption_usizeZ_None_class =
12092                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$None"));
12093         CHECK(LDKCOption_usizeZ_None_class != NULL);
12094         LDKCOption_usizeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_None_class, "<init>", "()V");
12095         CHECK(LDKCOption_usizeZ_None_meth != NULL);
12096 }
12097 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1usizeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12098         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
12099         switch(obj->tag) {
12100                 case LDKCOption_usizeZ_Some: {
12101                         int64_t some_conv = obj->some;
12102                         return (*env)->NewObject(env, LDKCOption_usizeZ_Some_class, LDKCOption_usizeZ_Some_meth, some_conv);
12103                 }
12104                 case LDKCOption_usizeZ_None: {
12105                         return (*env)->NewObject(env, LDKCOption_usizeZ_None_class, LDKCOption_usizeZ_None_meth);
12106                 }
12107                 default: abort();
12108         }
12109 }
12110 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
12111         LDKShutdownScript ret = *owner->contents.result;
12112         ret.is_owned = false;
12113         return ret;
12114 }
12115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12116         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
12117         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
12118         int64_t ret_ref = 0;
12119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12121         return ret_ref;
12122 }
12123
12124 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
12125 CHECK(!owner->result_ok);
12126         return DecodeError_clone(&*owner->contents.err);
12127 }
12128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12129         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
12130         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12131         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
12132         int64_t ret_ref = tag_ptr(ret_copy, true);
12133         return ret_ref;
12134 }
12135
12136 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
12137         LDKShutdownScript ret = *owner->contents.result;
12138         ret.is_owned = false;
12139         return ret;
12140 }
12141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12142         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
12143         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
12144         int64_t ret_ref = 0;
12145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12147         return ret_ref;
12148 }
12149
12150 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
12151         LDKInvalidShutdownScript ret = *owner->contents.err;
12152         ret.is_owned = false;
12153         return ret;
12154 }
12155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12156         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
12157         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
12158         int64_t ret_ref = 0;
12159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12161         return ret_ref;
12162 }
12163
12164 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
12165 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
12166 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
12167 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
12168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
12169         LDKPaymentPurpose_InvoicePayment_class =
12170                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
12171         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
12172         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "(J[B)V");
12173         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
12174         LDKPaymentPurpose_SpontaneousPayment_class =
12175                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
12176         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
12177         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
12178         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
12179 }
12180 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12181         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
12182         switch(obj->tag) {
12183                 case LDKPaymentPurpose_InvoicePayment: {
12184                         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
12185                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
12186                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
12187                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
12188                 }
12189                 case LDKPaymentPurpose_SpontaneousPayment: {
12190                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
12191                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
12192                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
12193                 }
12194                 default: abort();
12195         }
12196 }
12197 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
12198 CHECK(owner->result_ok);
12199         return PaymentPurpose_clone(&*owner->contents.result);
12200 }
12201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12202         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
12203         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12204         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
12205         int64_t ret_ref = tag_ptr(ret_copy, true);
12206         return ret_ref;
12207 }
12208
12209 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
12210 CHECK(!owner->result_ok);
12211         return DecodeError_clone(&*owner->contents.err);
12212 }
12213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12214         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
12215         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12216         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
12217         int64_t ret_ref = tag_ptr(ret_copy, true);
12218         return ret_ref;
12219 }
12220
12221 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
12222         LDKClaimedHTLC ret = *owner->contents.result;
12223         ret.is_owned = false;
12224         return ret;
12225 }
12226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12227         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
12228         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
12229         int64_t ret_ref = 0;
12230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12232         return ret_ref;
12233 }
12234
12235 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
12236 CHECK(!owner->result_ok);
12237         return DecodeError_clone(&*owner->contents.err);
12238 }
12239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12240         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
12241         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12242         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
12243         int64_t ret_ref = tag_ptr(ret_copy, true);
12244         return ret_ref;
12245 }
12246
12247 static jclass LDKPathFailure_InitialSend_class = NULL;
12248 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
12249 static jclass LDKPathFailure_OnPath_class = NULL;
12250 static jmethodID LDKPathFailure_OnPath_meth = NULL;
12251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
12252         LDKPathFailure_InitialSend_class =
12253                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
12254         CHECK(LDKPathFailure_InitialSend_class != NULL);
12255         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
12256         CHECK(LDKPathFailure_InitialSend_meth != NULL);
12257         LDKPathFailure_OnPath_class =
12258                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
12259         CHECK(LDKPathFailure_OnPath_class != NULL);
12260         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
12261         CHECK(LDKPathFailure_OnPath_meth != NULL);
12262 }
12263 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12264         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
12265         switch(obj->tag) {
12266                 case LDKPathFailure_InitialSend: {
12267                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
12268                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
12269                 }
12270                 case LDKPathFailure_OnPath: {
12271                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
12272                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
12273                 }
12274                 default: abort();
12275         }
12276 }
12277 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
12278 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
12279 static jclass LDKCOption_PathFailureZ_None_class = NULL;
12280 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
12281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
12282         LDKCOption_PathFailureZ_Some_class =
12283                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
12284         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
12285         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
12286         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
12287         LDKCOption_PathFailureZ_None_class =
12288                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
12289         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
12290         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
12291         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
12292 }
12293 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12294         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
12295         switch(obj->tag) {
12296                 case LDKCOption_PathFailureZ_Some: {
12297                         int64_t some_ref = tag_ptr(&obj->some, false);
12298                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
12299                 }
12300                 case LDKCOption_PathFailureZ_None: {
12301                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
12302                 }
12303                 default: abort();
12304         }
12305 }
12306 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
12307 CHECK(owner->result_ok);
12308         return COption_PathFailureZ_clone(&*owner->contents.result);
12309 }
12310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12311         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
12312         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
12313         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
12314         int64_t ret_ref = tag_ptr(ret_copy, true);
12315         return ret_ref;
12316 }
12317
12318 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
12319 CHECK(!owner->result_ok);
12320         return DecodeError_clone(&*owner->contents.err);
12321 }
12322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12323         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
12324         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12325         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
12326         int64_t ret_ref = tag_ptr(ret_copy, true);
12327         return ret_ref;
12328 }
12329
12330 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
12331 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
12332 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
12333 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
12334 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
12335 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
12336 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
12337 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
12338 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
12339 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
12340 static jclass LDKClosureReason_ProcessingError_class = NULL;
12341 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
12342 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
12343 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
12344 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
12345 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
12346 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
12347 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
12348 static jclass LDKClosureReason_FundingBatchClosure_class = NULL;
12349 static jmethodID LDKClosureReason_FundingBatchClosure_meth = NULL;
12350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
12351         LDKClosureReason_CounterpartyForceClosed_class =
12352                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
12353         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
12354         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
12355         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
12356         LDKClosureReason_HolderForceClosed_class =
12357                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
12358         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
12359         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
12360         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
12361         LDKClosureReason_CooperativeClosure_class =
12362                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
12363         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
12364         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
12365         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
12366         LDKClosureReason_CommitmentTxConfirmed_class =
12367                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
12368         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
12369         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
12370         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
12371         LDKClosureReason_FundingTimedOut_class =
12372                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
12373         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
12374         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
12375         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
12376         LDKClosureReason_ProcessingError_class =
12377                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
12378         CHECK(LDKClosureReason_ProcessingError_class != NULL);
12379         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
12380         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
12381         LDKClosureReason_DisconnectedPeer_class =
12382                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
12383         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
12384         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
12385         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
12386         LDKClosureReason_OutdatedChannelManager_class =
12387                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
12388         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
12389         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
12390         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
12391         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
12392                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
12393         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
12394         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
12395         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
12396         LDKClosureReason_FundingBatchClosure_class =
12397                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingBatchClosure"));
12398         CHECK(LDKClosureReason_FundingBatchClosure_class != NULL);
12399         LDKClosureReason_FundingBatchClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingBatchClosure_class, "<init>", "()V");
12400         CHECK(LDKClosureReason_FundingBatchClosure_meth != NULL);
12401 }
12402 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12403         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
12404         switch(obj->tag) {
12405                 case LDKClosureReason_CounterpartyForceClosed: {
12406                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
12407                         int64_t peer_msg_ref = 0;
12408                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
12409                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
12410                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
12411                 }
12412                 case LDKClosureReason_HolderForceClosed: {
12413                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
12414                 }
12415                 case LDKClosureReason_CooperativeClosure: {
12416                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
12417                 }
12418                 case LDKClosureReason_CommitmentTxConfirmed: {
12419                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
12420                 }
12421                 case LDKClosureReason_FundingTimedOut: {
12422                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
12423                 }
12424                 case LDKClosureReason_ProcessingError: {
12425                         LDKStr err_str = obj->processing_error.err;
12426                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
12427                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
12428                 }
12429                 case LDKClosureReason_DisconnectedPeer: {
12430                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
12431                 }
12432                 case LDKClosureReason_OutdatedChannelManager: {
12433                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
12434                 }
12435                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
12436                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
12437                 }
12438                 case LDKClosureReason_FundingBatchClosure: {
12439                         return (*env)->NewObject(env, LDKClosureReason_FundingBatchClosure_class, LDKClosureReason_FundingBatchClosure_meth);
12440                 }
12441                 default: abort();
12442         }
12443 }
12444 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
12445 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
12446 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
12447 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
12448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
12449         LDKCOption_ClosureReasonZ_Some_class =
12450                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
12451         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
12452         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
12453         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
12454         LDKCOption_ClosureReasonZ_None_class =
12455                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
12456         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
12457         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
12458         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
12459 }
12460 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12461         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
12462         switch(obj->tag) {
12463                 case LDKCOption_ClosureReasonZ_Some: {
12464                         int64_t some_ref = tag_ptr(&obj->some, false);
12465                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
12466                 }
12467                 case LDKCOption_ClosureReasonZ_None: {
12468                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
12469                 }
12470                 default: abort();
12471         }
12472 }
12473 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
12474 CHECK(owner->result_ok);
12475         return COption_ClosureReasonZ_clone(&*owner->contents.result);
12476 }
12477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12478         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
12479         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12480         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
12481         int64_t ret_ref = tag_ptr(ret_copy, true);
12482         return ret_ref;
12483 }
12484
12485 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
12486 CHECK(!owner->result_ok);
12487         return DecodeError_clone(&*owner->contents.err);
12488 }
12489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12490         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
12491         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12492         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
12493         int64_t ret_ref = tag_ptr(ret_copy, true);
12494         return ret_ref;
12495 }
12496
12497 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
12498 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
12499 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
12500 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
12501 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
12502 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
12503 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
12504 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
12505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
12506         LDKHTLCDestination_NextHopChannel_class =
12507                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
12508         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
12509         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
12510         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
12511         LDKHTLCDestination_UnknownNextHop_class =
12512                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
12513         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
12514         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
12515         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
12516         LDKHTLCDestination_InvalidForward_class =
12517                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
12518         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
12519         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
12520         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
12521         LDKHTLCDestination_FailedPayment_class =
12522                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
12523         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
12524         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
12525         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
12526 }
12527 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12528         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
12529         switch(obj->tag) {
12530                 case LDKHTLCDestination_NextHopChannel: {
12531                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
12532                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
12533                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12534                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
12535                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
12536                 }
12537                 case LDKHTLCDestination_UnknownNextHop: {
12538                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
12539                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
12540                 }
12541                 case LDKHTLCDestination_InvalidForward: {
12542                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
12543                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
12544                 }
12545                 case LDKHTLCDestination_FailedPayment: {
12546                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12547                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
12548                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
12549                 }
12550                 default: abort();
12551         }
12552 }
12553 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
12554 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
12555 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
12556 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
12557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
12558         LDKCOption_HTLCDestinationZ_Some_class =
12559                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
12560         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
12561         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
12562         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
12563         LDKCOption_HTLCDestinationZ_None_class =
12564                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
12565         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
12566         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
12567         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
12568 }
12569 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12570         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
12571         switch(obj->tag) {
12572                 case LDKCOption_HTLCDestinationZ_Some: {
12573                         int64_t some_ref = tag_ptr(&obj->some, false);
12574                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
12575                 }
12576                 case LDKCOption_HTLCDestinationZ_None: {
12577                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
12578                 }
12579                 default: abort();
12580         }
12581 }
12582 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12583 CHECK(owner->result_ok);
12584         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
12585 }
12586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12587         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12588         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12589         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
12590         int64_t ret_ref = tag_ptr(ret_copy, true);
12591         return ret_ref;
12592 }
12593
12594 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12595 CHECK(!owner->result_ok);
12596         return DecodeError_clone(&*owner->contents.err);
12597 }
12598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12599         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12600         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12601         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
12602         int64_t ret_ref = tag_ptr(ret_copy, true);
12603         return ret_ref;
12604 }
12605
12606 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12607 CHECK(owner->result_ok);
12608         return PaymentFailureReason_clone(&*owner->contents.result);
12609 }
12610 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12611         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12612         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
12613         return ret_conv;
12614 }
12615
12616 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12617 CHECK(!owner->result_ok);
12618         return DecodeError_clone(&*owner->contents.err);
12619 }
12620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12621         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12622         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12623         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
12624         int64_t ret_ref = tag_ptr(ret_copy, true);
12625         return ret_ref;
12626 }
12627
12628 static jclass LDKCOption_U128Z_Some_class = NULL;
12629 static jmethodID LDKCOption_U128Z_Some_meth = NULL;
12630 static jclass LDKCOption_U128Z_None_class = NULL;
12631 static jmethodID LDKCOption_U128Z_None_meth = NULL;
12632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1U128Z_init (JNIEnv *env, jclass clz) {
12633         LDKCOption_U128Z_Some_class =
12634                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$Some"));
12635         CHECK(LDKCOption_U128Z_Some_class != NULL);
12636         LDKCOption_U128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_Some_class, "<init>", "([B)V");
12637         CHECK(LDKCOption_U128Z_Some_meth != NULL);
12638         LDKCOption_U128Z_None_class =
12639                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$None"));
12640         CHECK(LDKCOption_U128Z_None_class != NULL);
12641         LDKCOption_U128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_None_class, "<init>", "()V");
12642         CHECK(LDKCOption_U128Z_None_meth != NULL);
12643 }
12644 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1U128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12645         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
12646         switch(obj->tag) {
12647                 case LDKCOption_U128Z_Some: {
12648                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
12649                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
12650                         return (*env)->NewObject(env, LDKCOption_U128Z_Some_class, LDKCOption_U128Z_Some_meth, some_arr);
12651                 }
12652                 case LDKCOption_U128Z_None: {
12653                         return (*env)->NewObject(env, LDKCOption_U128Z_None_class, LDKCOption_U128Z_None_meth);
12654                 }
12655                 default: abort();
12656         }
12657 }
12658 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
12659         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
12660         for (size_t i = 0; i < ret.datalen; i++) {
12661                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
12662         }
12663         return ret;
12664 }
12665 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
12666 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
12667 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
12668 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
12669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
12670         LDKCOption_PaymentFailureReasonZ_Some_class =
12671                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
12672         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
12673         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
12674         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
12675         LDKCOption_PaymentFailureReasonZ_None_class =
12676                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
12677         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
12678         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
12679         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
12680 }
12681 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12682         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
12683         switch(obj->tag) {
12684                 case LDKCOption_PaymentFailureReasonZ_Some: {
12685                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
12686                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
12687                 }
12688                 case LDKCOption_PaymentFailureReasonZ_None: {
12689                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
12690                 }
12691                 default: abort();
12692         }
12693 }
12694 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
12695 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
12696 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
12697 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
12698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
12699         LDKBumpTransactionEvent_ChannelClose_class =
12700                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
12701         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
12702         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "([BI[BJJ[J)V");
12703         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
12704         LDKBumpTransactionEvent_HTLCResolution_class =
12705                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
12706         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
12707         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "([BI[JI)V");
12708         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
12709 }
12710 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12711         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
12712         switch(obj->tag) {
12713                 case LDKBumpTransactionEvent_ChannelClose: {
12714                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12715                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
12716                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
12717                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
12718                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
12719                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
12720                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
12721                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
12722                         int64_t anchor_descriptor_ref = 0;
12723                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
12724                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
12725                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
12726                         int64_tArray pending_htlcs_arr = NULL;
12727                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
12728                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
12729                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
12730                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
12731                                 int64_t pending_htlcs_conv_24_ref = 0;
12732                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
12733                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
12734                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
12735                         }
12736                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
12737                         return (*env)->NewObject(env, LDKBumpTransactionEvent_ChannelClose_class, LDKBumpTransactionEvent_ChannelClose_meth, claim_id_arr, package_target_feerate_sat_per_1000_weight_conv, commitment_tx_arr, commitment_tx_fee_satoshis_conv, anchor_descriptor_ref, pending_htlcs_arr);
12738                 }
12739                 case LDKBumpTransactionEvent_HTLCResolution: {
12740                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12741                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
12742                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
12743                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
12744                         int64_tArray htlc_descriptors_arr = NULL;
12745                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
12746                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
12747                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
12748                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
12749                                 int64_t htlc_descriptors_conv_16_ref = 0;
12750                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
12751                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
12752                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
12753                         }
12754                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
12755                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
12756                         return (*env)->NewObject(env, LDKBumpTransactionEvent_HTLCResolution_class, LDKBumpTransactionEvent_HTLCResolution_meth, claim_id_arr, target_feerate_sat_per_1000_weight_conv, htlc_descriptors_arr, tx_lock_time_conv);
12757                 }
12758                 default: abort();
12759         }
12760 }
12761 static jclass LDKEvent_FundingGenerationReady_class = NULL;
12762 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
12763 static jclass LDKEvent_PaymentClaimable_class = NULL;
12764 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
12765 static jclass LDKEvent_PaymentClaimed_class = NULL;
12766 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
12767 static jclass LDKEvent_PaymentSent_class = NULL;
12768 static jmethodID LDKEvent_PaymentSent_meth = NULL;
12769 static jclass LDKEvent_PaymentFailed_class = NULL;
12770 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
12771 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
12772 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
12773 static jclass LDKEvent_PaymentPathFailed_class = NULL;
12774 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
12775 static jclass LDKEvent_ProbeSuccessful_class = NULL;
12776 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
12777 static jclass LDKEvent_ProbeFailed_class = NULL;
12778 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
12779 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
12780 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
12781 static jclass LDKEvent_HTLCIntercepted_class = NULL;
12782 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
12783 static jclass LDKEvent_SpendableOutputs_class = NULL;
12784 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
12785 static jclass LDKEvent_PaymentForwarded_class = NULL;
12786 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
12787 static jclass LDKEvent_ChannelPending_class = NULL;
12788 static jmethodID LDKEvent_ChannelPending_meth = NULL;
12789 static jclass LDKEvent_ChannelReady_class = NULL;
12790 static jmethodID LDKEvent_ChannelReady_meth = NULL;
12791 static jclass LDKEvent_ChannelClosed_class = NULL;
12792 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
12793 static jclass LDKEvent_DiscardFunding_class = NULL;
12794 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
12795 static jclass LDKEvent_OpenChannelRequest_class = NULL;
12796 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
12797 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
12798 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
12799 static jclass LDKEvent_BumpTransaction_class = NULL;
12800 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
12801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
12802         LDKEvent_FundingGenerationReady_class =
12803                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
12804         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
12805         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[B[B)V");
12806         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
12807         LDKEvent_PaymentClaimable_class =
12808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
12809         CHECK(LDKEvent_PaymentClaimable_class != NULL);
12810         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJJJJ)V");
12811         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
12812         LDKEvent_PaymentClaimed_class =
12813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
12814         CHECK(LDKEvent_PaymentClaimed_class != NULL);
12815         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ[JJ)V");
12816         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
12817         LDKEvent_PaymentSent_class =
12818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
12819         CHECK(LDKEvent_PaymentSent_class != NULL);
12820         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
12821         CHECK(LDKEvent_PaymentSent_meth != NULL);
12822         LDKEvent_PaymentFailed_class =
12823                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
12824         CHECK(LDKEvent_PaymentFailed_class != NULL);
12825         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
12826         CHECK(LDKEvent_PaymentFailed_meth != NULL);
12827         LDKEvent_PaymentPathSuccessful_class =
12828                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
12829         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
12830         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
12831         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
12832         LDKEvent_PaymentPathFailed_class =
12833                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
12834         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
12835         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
12836         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
12837         LDKEvent_ProbeSuccessful_class =
12838                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
12839         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
12840         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
12841         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
12842         LDKEvent_ProbeFailed_class =
12843                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
12844         CHECK(LDKEvent_ProbeFailed_class != NULL);
12845         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
12846         CHECK(LDKEvent_ProbeFailed_meth != NULL);
12847         LDKEvent_PendingHTLCsForwardable_class =
12848                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
12849         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
12850         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
12851         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
12852         LDKEvent_HTLCIntercepted_class =
12853                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
12854         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
12855         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
12856         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
12857         LDKEvent_SpendableOutputs_class =
12858                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
12859         CHECK(LDKEvent_SpendableOutputs_class != NULL);
12860         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([JJ)V");
12861         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
12862         LDKEvent_PaymentForwarded_class =
12863                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
12864         CHECK(LDKEvent_PaymentForwarded_class != NULL);
12865         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JJJZJ)V");
12866         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
12867         LDKEvent_ChannelPending_class =
12868                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
12869         CHECK(LDKEvent_ChannelPending_class != NULL);
12870         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "([B[BJ[BJ)V");
12871         CHECK(LDKEvent_ChannelPending_meth != NULL);
12872         LDKEvent_ChannelReady_class =
12873                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
12874         CHECK(LDKEvent_ChannelReady_class != NULL);
12875         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "([B[B[BJ)V");
12876         CHECK(LDKEvent_ChannelReady_meth != NULL);
12877         LDKEvent_ChannelClosed_class =
12878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
12879         CHECK(LDKEvent_ChannelClosed_class != NULL);
12880         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([B[BJ[BJ)V");
12881         CHECK(LDKEvent_ChannelClosed_meth != NULL);
12882         LDKEvent_DiscardFunding_class =
12883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
12884         CHECK(LDKEvent_DiscardFunding_class != NULL);
12885         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
12886         CHECK(LDKEvent_DiscardFunding_meth != NULL);
12887         LDKEvent_OpenChannelRequest_class =
12888                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
12889         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
12890         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
12891         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
12892         LDKEvent_HTLCHandlingFailed_class =
12893                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
12894         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
12895         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
12896         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
12897         LDKEvent_BumpTransaction_class =
12898                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
12899         CHECK(LDKEvent_BumpTransaction_class != NULL);
12900         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
12901         CHECK(LDKEvent_BumpTransaction_meth != NULL);
12902 }
12903 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12904         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12905         switch(obj->tag) {
12906                 case LDKEvent_FundingGenerationReady: {
12907                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
12908                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
12909                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12910                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
12911                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
12912                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
12913                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
12914                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
12915                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12916                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
12917                         return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, counterparty_node_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_arr);
12918                 }
12919                 case LDKEvent_PaymentClaimable: {
12920                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
12921                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
12922                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12923                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
12924                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
12925                         int64_t onion_fields_ref = 0;
12926                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
12927                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
12928                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
12929                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
12930                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
12931                         int64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
12932                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
12933                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
12934                         return (*env)->NewObject(env, LDKEvent_PaymentClaimable_class, LDKEvent_PaymentClaimable_meth, receiver_node_id_arr, payment_hash_arr, onion_fields_ref, amount_msat_conv, counterparty_skimmed_fee_msat_conv, purpose_ref, via_channel_id_ref, via_user_channel_id_ref, claim_deadline_ref);
12935                 }
12936                 case LDKEvent_PaymentClaimed: {
12937                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
12938                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
12939                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12940                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
12941                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
12942                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
12943                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
12944                         int64_tArray htlcs_arr = NULL;
12945                         htlcs_arr = (*env)->NewLongArray(env, htlcs_var.datalen);
12946                         int64_t *htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlcs_arr, NULL);
12947                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
12948                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
12949                                 int64_t htlcs_conv_13_ref = 0;
12950                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
12951                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
12952                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
12953                         }
12954                         (*env)->ReleasePrimitiveArrayCritical(env, htlcs_arr, htlcs_arr_ptr, 0);
12955                         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
12956                         return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, receiver_node_id_arr, payment_hash_arr, amount_msat_conv, purpose_ref, htlcs_arr, sender_intended_total_msat_ref);
12957                 }
12958                 case LDKEvent_PaymentSent: {
12959                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
12960                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
12961                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
12962                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12963                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
12964                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
12965                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
12966                 }
12967                 case LDKEvent_PaymentFailed: {
12968                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12969                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
12970                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12971                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
12972                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
12973                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
12974                 }
12975                 case LDKEvent_PaymentPathSuccessful: {
12976                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12977                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
12978                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
12979                         LDKPath path_var = obj->payment_path_successful.path;
12980                         int64_t path_ref = 0;
12981                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12982                         path_ref = tag_ptr(path_var.inner, false);
12983                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
12984                 }
12985                 case LDKEvent_PaymentPathFailed: {
12986                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
12987                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12988                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
12989                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
12990                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
12991                         LDKPath path_var = obj->payment_path_failed.path;
12992                         int64_t path_ref = 0;
12993                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12994                         path_ref = tag_ptr(path_var.inner, false);
12995                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
12996                         return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_ref, payment_hash_arr, payment_failed_permanently_conv, failure_ref, path_ref, short_channel_id_ref);
12997                 }
12998                 case LDKEvent_ProbeSuccessful: {
12999                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13000                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
13001                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13002                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
13003                         LDKPath path_var = obj->probe_successful.path;
13004                         int64_t path_ref = 0;
13005                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13006                         path_ref = tag_ptr(path_var.inner, false);
13007                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
13008                 }
13009                 case LDKEvent_ProbeFailed: {
13010                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13011                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
13012                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13013                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
13014                         LDKPath path_var = obj->probe_failed.path;
13015                         int64_t path_ref = 0;
13016                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13017                         path_ref = tag_ptr(path_var.inner, false);
13018                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
13019                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
13020                 }
13021                 case LDKEvent_PendingHTLCsForwardable: {
13022                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
13023                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
13024                 }
13025                 case LDKEvent_HTLCIntercepted: {
13026                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
13027                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
13028                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
13029                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13030                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
13031                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
13032                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
13033                         return (*env)->NewObject(env, LDKEvent_HTLCIntercepted_class, LDKEvent_HTLCIntercepted_meth, intercept_id_arr, requested_next_hop_scid_conv, payment_hash_arr, inbound_amount_msat_conv, expected_outbound_amount_msat_conv);
13034                 }
13035                 case LDKEvent_SpendableOutputs: {
13036                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
13037                         int64_tArray outputs_arr = NULL;
13038                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
13039                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
13040                         for (size_t b = 0; b < outputs_var.datalen; b++) {
13041                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
13042                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
13043                         }
13044                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
13045                         int64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
13046                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr, channel_id_ref);
13047                 }
13048                 case LDKEvent_PaymentForwarded: {
13049                         int64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
13050                         int64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
13051                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
13052                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
13053                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
13054                         return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_ref, claim_from_onchain_tx_conv, outbound_amount_forwarded_msat_ref);
13055                 }
13056                 case LDKEvent_ChannelPending: {
13057                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13058                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_pending.channel_id.data);
13059                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13060                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
13061                         int64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
13062                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13063                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
13064                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
13065                         int64_t funding_txo_ref = 0;
13066                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
13067                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
13068                         return (*env)->NewObject(env, LDKEvent_ChannelPending_class, LDKEvent_ChannelPending_meth, channel_id_arr, user_channel_id_arr, former_temporary_channel_id_ref, counterparty_node_id_arr, funding_txo_ref);
13069                 }
13070                 case LDKEvent_ChannelReady: {
13071                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13072                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_ready.channel_id.data);
13073                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13074                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
13075                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13076                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
13077                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
13078                         int64_t channel_type_ref = 0;
13079                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
13080                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
13081                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_arr, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
13082                 }
13083                 case LDKEvent_ChannelClosed: {
13084                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13085                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
13086                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13087                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
13088                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
13089                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13090                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_closed.counterparty_node_id.compressed_form);
13091                         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
13092                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_arr, reason_ref, counterparty_node_id_arr, channel_capacity_sats_ref);
13093                 }
13094                 case LDKEvent_DiscardFunding: {
13095                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13096                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
13097                         LDKTransaction transaction_var = obj->discard_funding.transaction;
13098                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
13099                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
13100                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
13101                 }
13102                 case LDKEvent_OpenChannelRequest: {
13103                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
13104                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
13105                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13106                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
13107                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
13108                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
13109                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
13110                         int64_t channel_type_ref = 0;
13111                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
13112                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
13113                         return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
13114                 }
13115                 case LDKEvent_HTLCHandlingFailed: {
13116                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
13117                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
13118                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
13119                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
13120                 }
13121                 case LDKEvent_BumpTransaction: {
13122                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
13123                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
13124                 }
13125                 default: abort();
13126         }
13127 }
13128 static jclass LDKCOption_EventZ_Some_class = NULL;
13129 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
13130 static jclass LDKCOption_EventZ_None_class = NULL;
13131 static jmethodID LDKCOption_EventZ_None_meth = NULL;
13132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
13133         LDKCOption_EventZ_Some_class =
13134                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
13135         CHECK(LDKCOption_EventZ_Some_class != NULL);
13136         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
13137         CHECK(LDKCOption_EventZ_Some_meth != NULL);
13138         LDKCOption_EventZ_None_class =
13139                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
13140         CHECK(LDKCOption_EventZ_None_class != NULL);
13141         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
13142         CHECK(LDKCOption_EventZ_None_meth != NULL);
13143 }
13144 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13145         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
13146         switch(obj->tag) {
13147                 case LDKCOption_EventZ_Some: {
13148                         int64_t some_ref = tag_ptr(&obj->some, false);
13149                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
13150                 }
13151                 case LDKCOption_EventZ_None: {
13152                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
13153                 }
13154                 default: abort();
13155         }
13156 }
13157 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
13158 CHECK(owner->result_ok);
13159         return COption_EventZ_clone(&*owner->contents.result);
13160 }
13161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13162         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
13163         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13164         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
13165         int64_t ret_ref = tag_ptr(ret_copy, true);
13166         return ret_ref;
13167 }
13168
13169 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
13170 CHECK(!owner->result_ok);
13171         return DecodeError_clone(&*owner->contents.err);
13172 }
13173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13174         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
13175         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13176         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
13177         int64_t ret_ref = tag_ptr(ret_copy, true);
13178         return ret_ref;
13179 }
13180
13181 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
13182 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
13183 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
13184 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
13185 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
13186 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
13187 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
13188 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
13189 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
13190 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
13191 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
13192 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
13193 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
13194 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
13195 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
13196 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
13197 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
13198 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
13199 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
13200 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
13201 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
13202 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
13203 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
13204 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
13205 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
13206 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
13207 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
13208 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
13209 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
13210 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
13211 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
13212 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
13213 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
13214 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
13215 static jclass LDKBolt11ParseError_Skip_class = NULL;
13216 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
13217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
13218         LDKBolt11ParseError_Bech32Error_class =
13219                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
13220         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
13221         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
13222         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
13223         LDKBolt11ParseError_ParseAmountError_class =
13224                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
13225         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
13226         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
13227         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
13228         LDKBolt11ParseError_MalformedSignature_class =
13229                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
13230         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
13231         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
13232         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
13233         LDKBolt11ParseError_BadPrefix_class =
13234                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
13235         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
13236         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
13237         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
13238         LDKBolt11ParseError_UnknownCurrency_class =
13239                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
13240         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
13241         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
13242         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
13243         LDKBolt11ParseError_UnknownSiPrefix_class =
13244                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
13245         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
13246         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
13247         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
13248         LDKBolt11ParseError_MalformedHRP_class =
13249                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
13250         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
13251         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
13252         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
13253         LDKBolt11ParseError_TooShortDataPart_class =
13254                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
13255         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
13256         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
13257         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
13258         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
13259                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
13260         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
13261         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
13262         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
13263         LDKBolt11ParseError_DescriptionDecodeError_class =
13264                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
13265         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
13266         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
13267         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
13268         LDKBolt11ParseError_PaddingError_class =
13269                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
13270         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
13271         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
13272         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
13273         LDKBolt11ParseError_IntegerOverflowError_class =
13274                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
13275         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
13276         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
13277         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
13278         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
13279                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
13280         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
13281         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
13282         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
13283         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
13284                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
13285         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
13286         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
13287         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
13288         LDKBolt11ParseError_InvalidScriptHashLength_class =
13289                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
13290         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
13291         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
13292         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
13293         LDKBolt11ParseError_InvalidRecoveryId_class =
13294                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
13295         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
13296         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
13297         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
13298         LDKBolt11ParseError_InvalidSliceLength_class =
13299                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
13300         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
13301         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
13302         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
13303         LDKBolt11ParseError_Skip_class =
13304                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
13305         CHECK(LDKBolt11ParseError_Skip_class != NULL);
13306         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
13307         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
13308 }
13309 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13310         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
13311         switch(obj->tag) {
13312                 case LDKBolt11ParseError_Bech32Error: {
13313                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
13314                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
13315                 }
13316                 case LDKBolt11ParseError_ParseAmountError: {
13317                         /*obj->parse_amount_error*/
13318                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
13319                 }
13320                 case LDKBolt11ParseError_MalformedSignature: {
13321                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
13322                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
13323                 }
13324                 case LDKBolt11ParseError_BadPrefix: {
13325                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
13326                 }
13327                 case LDKBolt11ParseError_UnknownCurrency: {
13328                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
13329                 }
13330                 case LDKBolt11ParseError_UnknownSiPrefix: {
13331                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
13332                 }
13333                 case LDKBolt11ParseError_MalformedHRP: {
13334                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
13335                 }
13336                 case LDKBolt11ParseError_TooShortDataPart: {
13337                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
13338                 }
13339                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
13340                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
13341                 }
13342                 case LDKBolt11ParseError_DescriptionDecodeError: {
13343                         /*obj->description_decode_error*/
13344                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
13345                 }
13346                 case LDKBolt11ParseError_PaddingError: {
13347                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
13348                 }
13349                 case LDKBolt11ParseError_IntegerOverflowError: {
13350                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
13351                 }
13352                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
13353                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
13354                 }
13355                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
13356                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
13357                 }
13358                 case LDKBolt11ParseError_InvalidScriptHashLength: {
13359                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
13360                 }
13361                 case LDKBolt11ParseError_InvalidRecoveryId: {
13362                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
13363                 }
13364                 case LDKBolt11ParseError_InvalidSliceLength: {
13365                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
13366                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
13367                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
13368                 }
13369                 case LDKBolt11ParseError_Skip: {
13370                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
13371                 }
13372                 default: abort();
13373         }
13374 }
13375 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
13376 CHECK(owner->result_ok);
13377         return SiPrefix_clone(&*owner->contents.result);
13378 }
13379 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13380         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
13381         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
13382         return ret_conv;
13383 }
13384
13385 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
13386 CHECK(!owner->result_ok);
13387         return Bolt11ParseError_clone(&*owner->contents.err);
13388 }
13389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13390         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
13391         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
13392         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
13393         int64_t ret_ref = tag_ptr(ret_copy, true);
13394         return ret_ref;
13395 }
13396
13397 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
13398 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
13399 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
13400 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
13401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
13402         LDKParseOrSemanticError_ParseError_class =
13403                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
13404         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
13405         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
13406         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
13407         LDKParseOrSemanticError_SemanticError_class =
13408                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
13409         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
13410         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
13411         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
13412 }
13413 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13414         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
13415         switch(obj->tag) {
13416                 case LDKParseOrSemanticError_ParseError: {
13417                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
13418                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
13419                 }
13420                 case LDKParseOrSemanticError_SemanticError: {
13421                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
13422                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
13423                 }
13424                 default: abort();
13425         }
13426 }
13427 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
13428         LDKBolt11Invoice ret = *owner->contents.result;
13429         ret.is_owned = false;
13430         return ret;
13431 }
13432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13433         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
13434         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
13435         int64_t ret_ref = 0;
13436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13438         return ret_ref;
13439 }
13440
13441 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
13442 CHECK(!owner->result_ok);
13443         return ParseOrSemanticError_clone(&*owner->contents.err);
13444 }
13445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13446         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
13447         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
13448         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
13449         int64_t ret_ref = tag_ptr(ret_copy, true);
13450         return ret_ref;
13451 }
13452
13453 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
13454         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
13455         ret.is_owned = false;
13456         return ret;
13457 }
13458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13459         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
13460         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
13461         int64_t ret_ref = 0;
13462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13464         return ret_ref;
13465 }
13466
13467 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
13468 CHECK(!owner->result_ok);
13469         return Bolt11ParseError_clone(&*owner->contents.err);
13470 }
13471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13472         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
13473         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
13474         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
13475         int64_t ret_ref = tag_ptr(ret_copy, true);
13476         return ret_ref;
13477 }
13478
13479 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13480         LDKRawBolt11Invoice ret = owner->a;
13481         ret.is_owned = false;
13482         return ret;
13483 }
13484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
13485         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13486         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
13487         int64_t ret_ref = 0;
13488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13490         return ret_ref;
13491 }
13492
13493 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13494         return ThirtyTwoBytes_clone(&owner->b);
13495 }
13496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
13497         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13498         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13499         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
13500         return ret_arr;
13501 }
13502
13503 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13504         LDKBolt11InvoiceSignature ret = owner->c;
13505         ret.is_owned = false;
13506         return ret;
13507 }
13508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
13509         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13510         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
13511         int64_t ret_ref = 0;
13512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13514         return ret_ref;
13515 }
13516
13517 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
13518         LDKPayeePubKey ret = *owner->contents.result;
13519         ret.is_owned = false;
13520         return ret;
13521 }
13522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13523         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
13524         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
13525         int64_t ret_ref = 0;
13526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13528         return ret_ref;
13529 }
13530
13531 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
13532 CHECK(!owner->result_ok);
13533         return *owner->contents.err;
13534 }
13535 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13536         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
13537         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
13538         return ret_conv;
13539 }
13540
13541 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
13542         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
13543         for (size_t i = 0; i < ret.datalen; i++) {
13544                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
13545         }
13546         return ret;
13547 }
13548 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13549         LDKPositiveTimestamp ret = *owner->contents.result;
13550         ret.is_owned = false;
13551         return ret;
13552 }
13553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13554         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13555         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
13556         int64_t ret_ref = 0;
13557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13559         return ret_ref;
13560 }
13561
13562 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13563 CHECK(!owner->result_ok);
13564         return CreationError_clone(&*owner->contents.err);
13565 }
13566 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13567         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13568         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
13569         return ret_conv;
13570 }
13571
13572 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13573 CHECK(owner->result_ok);
13574         return *owner->contents.result;
13575 }
13576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13577         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13578         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
13579 }
13580
13581 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13582 CHECK(!owner->result_ok);
13583         return Bolt11SemanticError_clone(&*owner->contents.err);
13584 }
13585 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13586         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13587         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
13588         return ret_conv;
13589 }
13590
13591 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13592         LDKBolt11Invoice ret = *owner->contents.result;
13593         ret.is_owned = false;
13594         return ret;
13595 }
13596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13597         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13598         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
13599         int64_t ret_ref = 0;
13600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13602         return ret_ref;
13603 }
13604
13605 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13606 CHECK(!owner->result_ok);
13607         return Bolt11SemanticError_clone(&*owner->contents.err);
13608 }
13609 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13610         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13611         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
13612         return ret_conv;
13613 }
13614
13615 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13616         LDKDescription ret = *owner->contents.result;
13617         ret.is_owned = false;
13618         return ret;
13619 }
13620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13621         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13622         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
13623         int64_t ret_ref = 0;
13624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13626         return ret_ref;
13627 }
13628
13629 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13630 CHECK(!owner->result_ok);
13631         return CreationError_clone(&*owner->contents.err);
13632 }
13633 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13634         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13635         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
13636         return ret_conv;
13637 }
13638
13639 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13640         LDKPrivateRoute ret = *owner->contents.result;
13641         ret.is_owned = false;
13642         return ret;
13643 }
13644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13645         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13646         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
13647         int64_t ret_ref = 0;
13648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13650         return ret_ref;
13651 }
13652
13653 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13654 CHECK(!owner->result_ok);
13655         return CreationError_clone(&*owner->contents.err);
13656 }
13657 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13658         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13659         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
13660         return ret_conv;
13661 }
13662
13663 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13664         LDKOutPoint ret = *owner->contents.result;
13665         ret.is_owned = false;
13666         return ret;
13667 }
13668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13669         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13670         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
13671         int64_t ret_ref = 0;
13672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13674         return ret_ref;
13675 }
13676
13677 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13678 CHECK(!owner->result_ok);
13679         return DecodeError_clone(&*owner->contents.err);
13680 }
13681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13682         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13683         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13684         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
13685         int64_t ret_ref = tag_ptr(ret_copy, true);
13686         return ret_ref;
13687 }
13688
13689 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13690         LDKBigSize ret = *owner->contents.result;
13691         ret.is_owned = false;
13692         return ret;
13693 }
13694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13695         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13696         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
13697         int64_t ret_ref = 0;
13698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13700         return ret_ref;
13701 }
13702
13703 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13704 CHECK(!owner->result_ok);
13705         return DecodeError_clone(&*owner->contents.err);
13706 }
13707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13708         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13709         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13710         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
13711         int64_t ret_ref = tag_ptr(ret_copy, true);
13712         return ret_ref;
13713 }
13714
13715 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13716         LDKHostname ret = *owner->contents.result;
13717         ret.is_owned = false;
13718         return ret;
13719 }
13720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13721         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13722         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
13723         int64_t ret_ref = 0;
13724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13726         return ret_ref;
13727 }
13728
13729 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13730 CHECK(!owner->result_ok);
13731         return DecodeError_clone(&*owner->contents.err);
13732 }
13733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13734         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13735         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13736         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
13737         int64_t ret_ref = tag_ptr(ret_copy, true);
13738         return ret_ref;
13739 }
13740
13741 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13742         LDKTransactionU16LenLimited ret = *owner->contents.result;
13743         ret.is_owned = false;
13744         return ret;
13745 }
13746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13747         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13748         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
13749         int64_t ret_ref = 0;
13750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13752         return ret_ref;
13753 }
13754
13755 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13756 CHECK(!owner->result_ok);
13757         return *owner->contents.err;
13758 }
13759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13760         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13761         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
13762 }
13763
13764 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13765         LDKTransactionU16LenLimited ret = *owner->contents.result;
13766         ret.is_owned = false;
13767         return ret;
13768 }
13769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13770         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13771         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
13772         int64_t ret_ref = 0;
13773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13775         return ret_ref;
13776 }
13777
13778 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13779 CHECK(!owner->result_ok);
13780         return DecodeError_clone(&*owner->contents.err);
13781 }
13782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13783         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13784         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13785         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
13786         int64_t ret_ref = tag_ptr(ret_copy, true);
13787         return ret_ref;
13788 }
13789
13790 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13791         LDKUntrustedString ret = *owner->contents.result;
13792         ret.is_owned = false;
13793         return ret;
13794 }
13795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13796         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13797         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
13798         int64_t ret_ref = 0;
13799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13801         return ret_ref;
13802 }
13803
13804 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13805 CHECK(!owner->result_ok);
13806         return DecodeError_clone(&*owner->contents.err);
13807 }
13808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13809         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13810         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13811         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
13812         int64_t ret_ref = tag_ptr(ret_copy, true);
13813         return ret_ref;
13814 }
13815
13816 static inline struct LDKReceiveTlvs CResult_ReceiveTlvsDecodeErrorZ_get_ok(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
13817         LDKReceiveTlvs ret = *owner->contents.result;
13818         ret.is_owned = false;
13819         return ret;
13820 }
13821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13822         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
13823         LDKReceiveTlvs ret_var = CResult_ReceiveTlvsDecodeErrorZ_get_ok(owner_conv);
13824         int64_t ret_ref = 0;
13825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13827         return ret_ref;
13828 }
13829
13830 static inline struct LDKDecodeError CResult_ReceiveTlvsDecodeErrorZ_get_err(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
13831 CHECK(!owner->result_ok);
13832         return DecodeError_clone(&*owner->contents.err);
13833 }
13834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13835         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
13836         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13837         *ret_copy = CResult_ReceiveTlvsDecodeErrorZ_get_err(owner_conv);
13838         int64_t ret_ref = tag_ptr(ret_copy, true);
13839         return ret_ref;
13840 }
13841
13842 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
13843         LDKPaymentRelay ret = *owner->contents.result;
13844         ret.is_owned = false;
13845         return ret;
13846 }
13847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13848         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
13849         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
13850         int64_t ret_ref = 0;
13851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13853         return ret_ref;
13854 }
13855
13856 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
13857 CHECK(!owner->result_ok);
13858         return DecodeError_clone(&*owner->contents.err);
13859 }
13860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13861         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
13862         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13863         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
13864         int64_t ret_ref = tag_ptr(ret_copy, true);
13865         return ret_ref;
13866 }
13867
13868 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
13869         LDKPaymentConstraints ret = *owner->contents.result;
13870         ret.is_owned = false;
13871         return ret;
13872 }
13873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13874         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
13875         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
13876         int64_t ret_ref = 0;
13877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13879         return ret_ref;
13880 }
13881
13882 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
13883 CHECK(!owner->result_ok);
13884         return DecodeError_clone(&*owner->contents.err);
13885 }
13886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13887         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
13888         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13889         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
13890         int64_t ret_ref = tag_ptr(ret_copy, true);
13891         return ret_ref;
13892 }
13893
13894 static jclass LDKPaymentError_Invoice_class = NULL;
13895 static jmethodID LDKPaymentError_Invoice_meth = NULL;
13896 static jclass LDKPaymentError_Sending_class = NULL;
13897 static jmethodID LDKPaymentError_Sending_meth = NULL;
13898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
13899         LDKPaymentError_Invoice_class =
13900                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
13901         CHECK(LDKPaymentError_Invoice_class != NULL);
13902         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
13903         CHECK(LDKPaymentError_Invoice_meth != NULL);
13904         LDKPaymentError_Sending_class =
13905                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
13906         CHECK(LDKPaymentError_Sending_class != NULL);
13907         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(Lorg/ldk/enums/RetryableSendFailure;)V");
13908         CHECK(LDKPaymentError_Sending_meth != NULL);
13909 }
13910 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13911         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
13912         switch(obj->tag) {
13913                 case LDKPaymentError_Invoice: {
13914                         LDKStr invoice_str = obj->invoice;
13915                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
13916                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
13917                 }
13918                 case LDKPaymentError_Sending: {
13919                         jclass sending_conv = LDKRetryableSendFailure_to_java(env, obj->sending);
13920                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_conv);
13921                 }
13922                 default: abort();
13923         }
13924 }
13925 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
13926 CHECK(owner->result_ok);
13927         return ThirtyTwoBytes_clone(&*owner->contents.result);
13928 }
13929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13930         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
13931         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13932         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(owner_conv).data);
13933         return ret_arr;
13934 }
13935
13936 static inline struct LDKPaymentError CResult_ThirtyTwoBytesPaymentErrorZ_get_err(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
13937 CHECK(!owner->result_ok);
13938         return PaymentError_clone(&*owner->contents.err);
13939 }
13940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13941         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
13942         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
13943         *ret_copy = CResult_ThirtyTwoBytesPaymentErrorZ_get_err(owner_conv);
13944         int64_t ret_ref = tag_ptr(ret_copy, true);
13945         return ret_ref;
13946 }
13947
13948 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
13949 CHECK(owner->result_ok);
13950         return *owner->contents.result;
13951 }
13952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13953         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
13954         CResult_NonePaymentErrorZ_get_ok(owner_conv);
13955 }
13956
13957 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
13958 CHECK(!owner->result_ok);
13959         return PaymentError_clone(&*owner->contents.err);
13960 }
13961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13962         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
13963         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
13964         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
13965         int64_t ret_ref = tag_ptr(ret_copy, true);
13966         return ret_ref;
13967 }
13968
13969 static jclass LDKProbingError_Invoice_class = NULL;
13970 static jmethodID LDKProbingError_Invoice_meth = NULL;
13971 static jclass LDKProbingError_Sending_class = NULL;
13972 static jmethodID LDKProbingError_Sending_meth = NULL;
13973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbingError_init (JNIEnv *env, jclass clz) {
13974         LDKProbingError_Invoice_class =
13975                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbingError$Invoice"));
13976         CHECK(LDKProbingError_Invoice_class != NULL);
13977         LDKProbingError_Invoice_meth = (*env)->GetMethodID(env, LDKProbingError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
13978         CHECK(LDKProbingError_Invoice_meth != NULL);
13979         LDKProbingError_Sending_class =
13980                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbingError$Sending"));
13981         CHECK(LDKProbingError_Sending_class != NULL);
13982         LDKProbingError_Sending_meth = (*env)->GetMethodID(env, LDKProbingError_Sending_class, "<init>", "(J)V");
13983         CHECK(LDKProbingError_Sending_meth != NULL);
13984 }
13985 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbingError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13986         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
13987         switch(obj->tag) {
13988                 case LDKProbingError_Invoice: {
13989                         LDKStr invoice_str = obj->invoice;
13990                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
13991                         return (*env)->NewObject(env, LDKProbingError_Invoice_class, LDKProbingError_Invoice_meth, invoice_conv);
13992                 }
13993                 case LDKProbingError_Sending: {
13994                         int64_t sending_ref = tag_ptr(&obj->sending, false);
13995                         return (*env)->NewObject(env, LDKProbingError_Sending_class, LDKProbingError_Sending_meth, sending_ref);
13996                 }
13997                 default: abort();
13998         }
13999 }
14000 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
14001 CHECK(owner->result_ok);
14002         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
14003 }
14004 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14005         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
14006         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(owner_conv);
14007         int64_tArray ret_arr = NULL;
14008         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14009         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14010         for (size_t o = 0; o < ret_var.datalen; o++) {
14011                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
14012                 *ret_conv_40_conv = ret_var.data[o];
14013                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
14014         }
14015         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14016         FREE(ret_var.data);
14017         return ret_arr;
14018 }
14019
14020 static inline struct LDKProbingError CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
14021 CHECK(!owner->result_ok);
14022         return ProbingError_clone(&*owner->contents.err);
14023 }
14024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14025         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
14026         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
14027         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(owner_conv);
14028         int64_t ret_ref = tag_ptr(ret_copy, true);
14029         return ret_ref;
14030 }
14031
14032 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
14033 CHECK(owner->result_ok);
14034         return *owner->contents.result;
14035 }
14036 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14037         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
14038         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
14039         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14040         return ret_conv;
14041 }
14042
14043 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
14044 CHECK(!owner->result_ok);
14045         return *owner->contents.err;
14046 }
14047 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14048         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
14049         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
14050         return ret_conv;
14051 }
14052
14053 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
14054         LDKOnionMessagePath ret = *owner->contents.result;
14055         ret.is_owned = false;
14056         return ret;
14057 }
14058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14059         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
14060         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
14061         int64_t ret_ref = 0;
14062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14064         return ret_ref;
14065 }
14066
14067 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
14068 CHECK(!owner->result_ok);
14069         return *owner->contents.err;
14070 }
14071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14072         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
14073         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
14074 }
14075
14076 static inline struct LDKPublicKey C2Tuple_PublicKeyOnionMessageZ_get_a(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
14077         return owner->a;
14078 }
14079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14080         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
14081         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14082         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyOnionMessageZ_get_a(owner_conv).compressed_form);
14083         return ret_arr;
14084 }
14085
14086 static inline struct LDKOnionMessage C2Tuple_PublicKeyOnionMessageZ_get_b(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
14087         LDKOnionMessage ret = owner->b;
14088         ret.is_owned = false;
14089         return ret;
14090 }
14091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14092         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
14093         LDKOnionMessage ret_var = C2Tuple_PublicKeyOnionMessageZ_get_b(owner_conv);
14094         int64_t ret_ref = 0;
14095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14097         return ret_ref;
14098 }
14099
14100 static jclass LDKSendError_Secp256k1_class = NULL;
14101 static jmethodID LDKSendError_Secp256k1_meth = NULL;
14102 static jclass LDKSendError_TooBigPacket_class = NULL;
14103 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
14104 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
14105 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
14106 static jclass LDKSendError_InvalidFirstHop_class = NULL;
14107 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
14108 static jclass LDKSendError_InvalidMessage_class = NULL;
14109 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
14110 static jclass LDKSendError_BufferFull_class = NULL;
14111 static jmethodID LDKSendError_BufferFull_meth = NULL;
14112 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
14113 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
14114 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
14115 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
14116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
14117         LDKSendError_Secp256k1_class =
14118                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
14119         CHECK(LDKSendError_Secp256k1_class != NULL);
14120         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
14121         CHECK(LDKSendError_Secp256k1_meth != NULL);
14122         LDKSendError_TooBigPacket_class =
14123                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
14124         CHECK(LDKSendError_TooBigPacket_class != NULL);
14125         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
14126         CHECK(LDKSendError_TooBigPacket_meth != NULL);
14127         LDKSendError_TooFewBlindedHops_class =
14128                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
14129         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
14130         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
14131         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
14132         LDKSendError_InvalidFirstHop_class =
14133                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
14134         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
14135         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "()V");
14136         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
14137         LDKSendError_InvalidMessage_class =
14138                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
14139         CHECK(LDKSendError_InvalidMessage_class != NULL);
14140         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
14141         CHECK(LDKSendError_InvalidMessage_meth != NULL);
14142         LDKSendError_BufferFull_class =
14143                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
14144         CHECK(LDKSendError_BufferFull_class != NULL);
14145         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
14146         CHECK(LDKSendError_BufferFull_meth != NULL);
14147         LDKSendError_GetNodeIdFailed_class =
14148                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
14149         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
14150         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
14151         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
14152         LDKSendError_BlindedPathAdvanceFailed_class =
14153                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
14154         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
14155         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
14156         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
14157 }
14158 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14159         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
14160         switch(obj->tag) {
14161                 case LDKSendError_Secp256k1: {
14162                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
14163                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
14164                 }
14165                 case LDKSendError_TooBigPacket: {
14166                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
14167                 }
14168                 case LDKSendError_TooFewBlindedHops: {
14169                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
14170                 }
14171                 case LDKSendError_InvalidFirstHop: {
14172                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth);
14173                 }
14174                 case LDKSendError_InvalidMessage: {
14175                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
14176                 }
14177                 case LDKSendError_BufferFull: {
14178                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
14179                 }
14180                 case LDKSendError_GetNodeIdFailed: {
14181                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
14182                 }
14183                 case LDKSendError_BlindedPathAdvanceFailed: {
14184                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
14185                 }
14186                 default: abort();
14187         }
14188 }
14189 static inline struct LDKC2Tuple_PublicKeyOnionMessageZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
14190 CHECK(owner->result_ok);
14191         return C2Tuple_PublicKeyOnionMessageZ_clone(&*owner->contents.result);
14192 }
14193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14194         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
14195         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
14196         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(owner_conv);
14197         return tag_ptr(ret_conv, true);
14198 }
14199
14200 static inline struct LDKSendError CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
14201 CHECK(!owner->result_ok);
14202         return SendError_clone(&*owner->contents.err);
14203 }
14204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14205         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
14206         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
14207         *ret_copy = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(owner_conv);
14208         int64_t ret_ref = tag_ptr(ret_copy, true);
14209         return ret_ref;
14210 }
14211
14212 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
14213 CHECK(owner->result_ok);
14214         return *owner->contents.result;
14215 }
14216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14217         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
14218         CResult_NoneSendErrorZ_get_ok(owner_conv);
14219 }
14220
14221 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
14222 CHECK(!owner->result_ok);
14223         return SendError_clone(&*owner->contents.err);
14224 }
14225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14226         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
14227         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
14228         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
14229         int64_t ret_ref = tag_ptr(ret_copy, true);
14230         return ret_ref;
14231 }
14232
14233 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
14234         LDKBlindedPath ret = *owner->contents.result;
14235         ret.is_owned = false;
14236         return ret;
14237 }
14238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14239         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
14240         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
14241         int64_t ret_ref = 0;
14242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14244         return ret_ref;
14245 }
14246
14247 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
14248 CHECK(!owner->result_ok);
14249         return *owner->contents.err;
14250 }
14251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14252         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
14253         CResult_BlindedPathNoneZ_get_err(owner_conv);
14254 }
14255
14256 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
14257 CHECK(owner->result_ok);
14258         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
14259 }
14260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14261         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
14262         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
14263         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
14264         return tag_ptr(ret_conv, true);
14265 }
14266
14267 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
14268 CHECK(!owner->result_ok);
14269         return *owner->contents.err;
14270 }
14271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14272         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
14273         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
14274 }
14275
14276 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
14277         LDKBlindedPath ret = *owner->contents.result;
14278         ret.is_owned = false;
14279         return ret;
14280 }
14281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14282         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
14283         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
14284         int64_t ret_ref = 0;
14285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14287         return ret_ref;
14288 }
14289
14290 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
14291 CHECK(!owner->result_ok);
14292         return DecodeError_clone(&*owner->contents.err);
14293 }
14294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14295         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
14296         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14297         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
14298         int64_t ret_ref = tag_ptr(ret_copy, true);
14299         return ret_ref;
14300 }
14301
14302 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
14303         LDKBlindedHop ret = *owner->contents.result;
14304         ret.is_owned = false;
14305         return ret;
14306 }
14307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14308         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
14309         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
14310         int64_t ret_ref = 0;
14311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14313         return ret_ref;
14314 }
14315
14316 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
14317 CHECK(!owner->result_ok);
14318         return DecodeError_clone(&*owner->contents.err);
14319 }
14320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14321         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
14322         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14323         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
14324         int64_t ret_ref = tag_ptr(ret_copy, true);
14325         return ret_ref;
14326 }
14327
14328 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
14329         LDKInvoiceError ret = *owner->contents.result;
14330         ret.is_owned = false;
14331         return ret;
14332 }
14333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14334         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
14335         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
14336         int64_t ret_ref = 0;
14337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14339         return ret_ref;
14340 }
14341
14342 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
14343 CHECK(!owner->result_ok);
14344         return DecodeError_clone(&*owner->contents.err);
14345 }
14346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14347         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
14348         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14349         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
14350         int64_t ret_ref = tag_ptr(ret_copy, true);
14351         return ret_ref;
14352 }
14353
14354 typedef struct LDKFilter_JCalls {
14355         atomic_size_t refcnt;
14356         JavaVM *vm;
14357         jweak o;
14358         jmethodID register_tx_meth;
14359         jmethodID register_output_meth;
14360 } LDKFilter_JCalls;
14361 static void LDKFilter_JCalls_free(void* this_arg) {
14362         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14363         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14364                 JNIEnv *env;
14365                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14366                 if (get_jenv_res == JNI_EDETACHED) {
14367                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14368                 } else {
14369                         DO_ASSERT(get_jenv_res == JNI_OK);
14370                 }
14371                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14372                 if (get_jenv_res == JNI_EDETACHED) {
14373                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14374                 }
14375                 FREE(j_calls);
14376         }
14377 }
14378 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
14379         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14380         JNIEnv *env;
14381         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14382         if (get_jenv_res == JNI_EDETACHED) {
14383                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14384         } else {
14385                 DO_ASSERT(get_jenv_res == JNI_OK);
14386         }
14387         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
14388         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
14389         LDKu8slice script_pubkey_var = script_pubkey;
14390         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
14391         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
14392         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14393         CHECK(obj != NULL);
14394         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
14395         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14396                 (*env)->ExceptionDescribe(env);
14397                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
14398         }
14399         if (get_jenv_res == JNI_EDETACHED) {
14400                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14401         }
14402 }
14403 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
14404         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14405         JNIEnv *env;
14406         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14407         if (get_jenv_res == JNI_EDETACHED) {
14408                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14409         } else {
14410                 DO_ASSERT(get_jenv_res == JNI_OK);
14411         }
14412         LDKWatchedOutput output_var = output;
14413         int64_t output_ref = 0;
14414         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
14415         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
14416         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14417         CHECK(obj != NULL);
14418         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
14419         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14420                 (*env)->ExceptionDescribe(env);
14421                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
14422         }
14423         if (get_jenv_res == JNI_EDETACHED) {
14424                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14425         }
14426 }
14427 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
14428         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
14429         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14430 }
14431 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
14432         jclass c = (*env)->GetObjectClass(env, o);
14433         CHECK(c != NULL);
14434         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
14435         atomic_init(&calls->refcnt, 1);
14436         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14437         calls->o = (*env)->NewWeakGlobalRef(env, o);
14438         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
14439         CHECK(calls->register_tx_meth != NULL);
14440         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
14441         CHECK(calls->register_output_meth != NULL);
14442
14443         LDKFilter ret = {
14444                 .this_arg = (void*) calls,
14445                 .register_tx = register_tx_LDKFilter_jcall,
14446                 .register_output = register_output_LDKFilter_jcall,
14447                 .free = LDKFilter_JCalls_free,
14448         };
14449         return ret;
14450 }
14451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
14452         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
14453         *res_ptr = LDKFilter_init(env, clz, o);
14454         return tag_ptr(res_ptr, true);
14455 }
14456 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) {
14457         void* this_arg_ptr = untag_ptr(this_arg);
14458         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14459         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
14460         uint8_t txid_arr[32];
14461         CHECK((*env)->GetArrayLength(env, txid) == 32);
14462         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14463         uint8_t (*txid_ref)[32] = &txid_arr;
14464         LDKu8slice script_pubkey_ref;
14465         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14466         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
14467         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
14468         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
14469 }
14470
14471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
14472         void* this_arg_ptr = untag_ptr(this_arg);
14473         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14474         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
14475         LDKWatchedOutput output_conv;
14476         output_conv.inner = untag_ptr(output);
14477         output_conv.is_owned = ptr_is_owned(output);
14478         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
14479         output_conv = WatchedOutput_clone(&output_conv);
14480         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
14481 }
14482
14483 static jclass LDKCOption_FilterZ_Some_class = NULL;
14484 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
14485 static jclass LDKCOption_FilterZ_None_class = NULL;
14486 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
14487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
14488         LDKCOption_FilterZ_Some_class =
14489                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
14490         CHECK(LDKCOption_FilterZ_Some_class != NULL);
14491         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
14492         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
14493         LDKCOption_FilterZ_None_class =
14494                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
14495         CHECK(LDKCOption_FilterZ_None_class != NULL);
14496         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
14497         CHECK(LDKCOption_FilterZ_None_meth != NULL);
14498 }
14499 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14500         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
14501         switch(obj->tag) {
14502                 case LDKCOption_FilterZ_Some: {
14503                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
14504                         *some_ret = obj->some;
14505                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
14506                         if ((*some_ret).free == LDKFilter_JCalls_free) {
14507                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14508                                 LDKFilter_JCalls_cloned(&(*some_ret));
14509                         }
14510                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
14511                 }
14512                 case LDKCOption_FilterZ_None: {
14513                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
14514                 }
14515                 default: abort();
14516         }
14517 }
14518 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14519         LDKLockedChannelMonitor ret = *owner->contents.result;
14520         ret.is_owned = false;
14521         return ret;
14522 }
14523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14524         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14525         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
14526         int64_t ret_ref = 0;
14527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14529         return ret_ref;
14530 }
14531
14532 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14533 CHECK(!owner->result_ok);
14534         return *owner->contents.err;
14535 }
14536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14537         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14538         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
14539 }
14540
14541 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
14542         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
14543         for (size_t i = 0; i < ret.datalen; i++) {
14544                 ret.data[i] = OutPoint_clone(&orig->data[i]);
14545         }
14546         return ret;
14547 }
14548 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
14549         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
14550         for (size_t i = 0; i < ret.datalen; i++) {
14551                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
14552         }
14553         return ret;
14554 }
14555 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14556         LDKOutPoint ret = owner->a;
14557         ret.is_owned = false;
14558         return ret;
14559 }
14560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14561         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14562         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
14563         int64_t ret_ref = 0;
14564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14566         return ret_ref;
14567 }
14568
14569 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14570         return CVec_MonitorUpdateIdZ_clone(&owner->b);
14571 }
14572 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14573         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14574         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
14575         int64_tArray ret_arr = NULL;
14576         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14577         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14578         for (size_t r = 0; r < ret_var.datalen; r++) {
14579                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
14580                 int64_t ret_conv_17_ref = 0;
14581                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
14582                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
14583                 ret_arr_ptr[r] = ret_conv_17_ref;
14584         }
14585         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14586         FREE(ret_var.data);
14587         return ret_arr;
14588 }
14589
14590 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
14591         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
14592         for (size_t i = 0; i < ret.datalen; i++) {
14593                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
14594         }
14595         return ret;
14596 }
14597 typedef struct LDKKVStore_JCalls {
14598         atomic_size_t refcnt;
14599         JavaVM *vm;
14600         jweak o;
14601         jmethodID read_meth;
14602         jmethodID write_meth;
14603         jmethodID remove_meth;
14604         jmethodID list_meth;
14605 } LDKKVStore_JCalls;
14606 static void LDKKVStore_JCalls_free(void* this_arg) {
14607         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14608         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14609                 JNIEnv *env;
14610                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14611                 if (get_jenv_res == JNI_EDETACHED) {
14612                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14613                 } else {
14614                         DO_ASSERT(get_jenv_res == JNI_OK);
14615                 }
14616                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14617                 if (get_jenv_res == JNI_EDETACHED) {
14618                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14619                 }
14620                 FREE(j_calls);
14621         }
14622 }
14623 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
14624         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14625         JNIEnv *env;
14626         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14627         if (get_jenv_res == JNI_EDETACHED) {
14628                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14629         } else {
14630                 DO_ASSERT(get_jenv_res == JNI_OK);
14631         }
14632         LDKStr primary_namespace_str = primary_namespace;
14633         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14634         Str_free(primary_namespace_str);
14635         LDKStr secondary_namespace_str = secondary_namespace;
14636         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14637         Str_free(secondary_namespace_str);
14638         LDKStr key_str = key;
14639         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14640         Str_free(key_str);
14641         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14642         CHECK(obj != NULL);
14643         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, primary_namespace_conv, secondary_namespace_conv, key_conv);
14644         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14645                 (*env)->ExceptionDescribe(env);
14646                 (*env)->FatalError(env, "A call to read in LDKKVStore from rust threw an exception.");
14647         }
14648         void* ret_ptr = untag_ptr(ret);
14649         CHECK_ACCESS(ret_ptr);
14650         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
14651         FREE(untag_ptr(ret));
14652         if (get_jenv_res == JNI_EDETACHED) {
14653                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14654         }
14655         return ret_conv;
14656 }
14657 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
14658         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14659         JNIEnv *env;
14660         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14661         if (get_jenv_res == JNI_EDETACHED) {
14662                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14663         } else {
14664                 DO_ASSERT(get_jenv_res == JNI_OK);
14665         }
14666         LDKStr primary_namespace_str = primary_namespace;
14667         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14668         Str_free(primary_namespace_str);
14669         LDKStr secondary_namespace_str = secondary_namespace;
14670         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14671         Str_free(secondary_namespace_str);
14672         LDKStr key_str = key;
14673         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14674         Str_free(key_str);
14675         LDKu8slice buf_var = buf;
14676         int8_tArray buf_arr = (*env)->NewByteArray(env, buf_var.datalen);
14677         (*env)->SetByteArrayRegion(env, buf_arr, 0, buf_var.datalen, buf_var.data);
14678         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14679         CHECK(obj != NULL);
14680         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_arr);
14681         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14682                 (*env)->ExceptionDescribe(env);
14683                 (*env)->FatalError(env, "A call to write in LDKKVStore from rust threw an exception.");
14684         }
14685         void* ret_ptr = untag_ptr(ret);
14686         CHECK_ACCESS(ret_ptr);
14687         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14688         FREE(untag_ptr(ret));
14689         if (get_jenv_res == JNI_EDETACHED) {
14690                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14691         }
14692         return ret_conv;
14693 }
14694 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
14695         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14696         JNIEnv *env;
14697         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14698         if (get_jenv_res == JNI_EDETACHED) {
14699                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14700         } else {
14701                 DO_ASSERT(get_jenv_res == JNI_OK);
14702         }
14703         LDKStr primary_namespace_str = primary_namespace;
14704         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14705         Str_free(primary_namespace_str);
14706         LDKStr secondary_namespace_str = secondary_namespace;
14707         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14708         Str_free(secondary_namespace_str);
14709         LDKStr key_str = key;
14710         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14711         Str_free(key_str);
14712         jboolean lazy_conv = lazy;
14713         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14714         CHECK(obj != NULL);
14715         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->remove_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
14716         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14717                 (*env)->ExceptionDescribe(env);
14718                 (*env)->FatalError(env, "A call to remove in LDKKVStore from rust threw an exception.");
14719         }
14720         void* ret_ptr = untag_ptr(ret);
14721         CHECK_ACCESS(ret_ptr);
14722         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14723         FREE(untag_ptr(ret));
14724         if (get_jenv_res == JNI_EDETACHED) {
14725                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14726         }
14727         return ret_conv;
14728 }
14729 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
14730         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14731         JNIEnv *env;
14732         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14733         if (get_jenv_res == JNI_EDETACHED) {
14734                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14735         } else {
14736                 DO_ASSERT(get_jenv_res == JNI_OK);
14737         }
14738         LDKStr primary_namespace_str = primary_namespace;
14739         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14740         Str_free(primary_namespace_str);
14741         LDKStr secondary_namespace_str = secondary_namespace;
14742         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14743         Str_free(secondary_namespace_str);
14744         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14745         CHECK(obj != NULL);
14746         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_meth, primary_namespace_conv, secondary_namespace_conv);
14747         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14748                 (*env)->ExceptionDescribe(env);
14749                 (*env)->FatalError(env, "A call to list in LDKKVStore from rust threw an exception.");
14750         }
14751         void* ret_ptr = untag_ptr(ret);
14752         CHECK_ACCESS(ret_ptr);
14753         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
14754         FREE(untag_ptr(ret));
14755         if (get_jenv_res == JNI_EDETACHED) {
14756                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14757         }
14758         return ret_conv;
14759 }
14760 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
14761         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
14762         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14763 }
14764 static inline LDKKVStore LDKKVStore_init (JNIEnv *env, jclass clz, jobject o) {
14765         jclass c = (*env)->GetObjectClass(env, o);
14766         CHECK(c != NULL);
14767         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
14768         atomic_init(&calls->refcnt, 1);
14769         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14770         calls->o = (*env)->NewWeakGlobalRef(env, o);
14771         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J");
14772         CHECK(calls->read_meth != NULL);
14773         calls->write_meth = (*env)->GetMethodID(env, c, "write", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)J");
14774         CHECK(calls->write_meth != NULL);
14775         calls->remove_meth = (*env)->GetMethodID(env, c, "remove", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)J");
14776         CHECK(calls->remove_meth != NULL);
14777         calls->list_meth = (*env)->GetMethodID(env, c, "list", "(Ljava/lang/String;Ljava/lang/String;)J");
14778         CHECK(calls->list_meth != NULL);
14779
14780         LDKKVStore ret = {
14781                 .this_arg = (void*) calls,
14782                 .read = read_LDKKVStore_jcall,
14783                 .write = write_LDKKVStore_jcall,
14784                 .remove = remove_LDKKVStore_jcall,
14785                 .list = list_LDKKVStore_jcall,
14786                 .free = LDKKVStore_JCalls_free,
14787         };
14788         return ret;
14789 }
14790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKVStore_1new(JNIEnv *env, jclass clz, jobject o) {
14791         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
14792         *res_ptr = LDKKVStore_init(env, clz, o);
14793         return tag_ptr(res_ptr, true);
14794 }
14795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KVStore_1read(JNIEnv *env, jclass clz, int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
14796         void* this_arg_ptr = untag_ptr(this_arg);
14797         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14798         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14799         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
14800         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
14801         LDKStr key_conv = java_to_owned_str(env, key);
14802         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
14803         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
14804         return tag_ptr(ret_conv, true);
14805 }
14806
14807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KVStore_1write(JNIEnv *env, jclass clz, int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, int8_tArray buf) {
14808         void* this_arg_ptr = untag_ptr(this_arg);
14809         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14810         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14811         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
14812         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
14813         LDKStr key_conv = java_to_owned_str(env, key);
14814         LDKu8slice buf_ref;
14815         buf_ref.datalen = (*env)->GetArrayLength(env, buf);
14816         buf_ref.data = (*env)->GetByteArrayElements (env, buf, NULL);
14817         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14818         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
14819         (*env)->ReleaseByteArrayElements(env, buf, (int8_t*)buf_ref.data, 0);
14820         return tag_ptr(ret_conv, true);
14821 }
14822
14823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KVStore_1remove(JNIEnv *env, jclass clz, int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, jboolean lazy) {
14824         void* this_arg_ptr = untag_ptr(this_arg);
14825         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14826         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14827         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
14828         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
14829         LDKStr key_conv = java_to_owned_str(env, key);
14830         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14831         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
14832         return tag_ptr(ret_conv, true);
14833 }
14834
14835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KVStore_1list(JNIEnv *env, jclass clz, int64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
14836         void* this_arg_ptr = untag_ptr(this_arg);
14837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14838         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14839         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
14840         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
14841         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
14842         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
14843         return tag_ptr(ret_conv, true);
14844 }
14845
14846 typedef struct LDKPersister_JCalls {
14847         atomic_size_t refcnt;
14848         JavaVM *vm;
14849         jweak o;
14850         jmethodID persist_manager_meth;
14851         jmethodID persist_graph_meth;
14852         jmethodID persist_scorer_meth;
14853 } LDKPersister_JCalls;
14854 static void LDKPersister_JCalls_free(void* this_arg) {
14855         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14856         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14857                 JNIEnv *env;
14858                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14859                 if (get_jenv_res == JNI_EDETACHED) {
14860                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14861                 } else {
14862                         DO_ASSERT(get_jenv_res == JNI_OK);
14863                 }
14864                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14865                 if (get_jenv_res == JNI_EDETACHED) {
14866                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14867                 }
14868                 FREE(j_calls);
14869         }
14870 }
14871 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
14872         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14873         JNIEnv *env;
14874         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14875         if (get_jenv_res == JNI_EDETACHED) {
14876                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14877         } else {
14878                 DO_ASSERT(get_jenv_res == JNI_OK);
14879         }
14880         LDKChannelManager channel_manager_var = *channel_manager;
14881         int64_t channel_manager_ref = 0;
14882         // WARNING: we may need a move here but no clone is available for LDKChannelManager
14883         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
14884         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
14885         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14886         CHECK(obj != NULL);
14887         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
14888         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14889                 (*env)->ExceptionDescribe(env);
14890                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
14891         }
14892         void* ret_ptr = untag_ptr(ret);
14893         CHECK_ACCESS(ret_ptr);
14894         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14895         FREE(untag_ptr(ret));
14896         if (get_jenv_res == JNI_EDETACHED) {
14897                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14898         }
14899         return ret_conv;
14900 }
14901 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
14902         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14903         JNIEnv *env;
14904         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14905         if (get_jenv_res == JNI_EDETACHED) {
14906                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14907         } else {
14908                 DO_ASSERT(get_jenv_res == JNI_OK);
14909         }
14910         LDKNetworkGraph network_graph_var = *network_graph;
14911         int64_t network_graph_ref = 0;
14912         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
14913         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
14914         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
14915         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14916         CHECK(obj != NULL);
14917         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
14918         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14919                 (*env)->ExceptionDescribe(env);
14920                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
14921         }
14922         void* ret_ptr = untag_ptr(ret);
14923         CHECK_ACCESS(ret_ptr);
14924         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14925         FREE(untag_ptr(ret));
14926         if (get_jenv_res == JNI_EDETACHED) {
14927                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14928         }
14929         return ret_conv;
14930 }
14931 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
14932         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14933         JNIEnv *env;
14934         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14935         if (get_jenv_res == JNI_EDETACHED) {
14936                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14937         } else {
14938                 DO_ASSERT(get_jenv_res == JNI_OK);
14939         }
14940         // WARNING: This object doesn't live past this scope, needs clone!
14941         int64_t ret_scorer = tag_ptr(scorer, false);
14942         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14943         CHECK(obj != NULL);
14944         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
14945         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14946                 (*env)->ExceptionDescribe(env);
14947                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
14948         }
14949         void* ret_ptr = untag_ptr(ret);
14950         CHECK_ACCESS(ret_ptr);
14951         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14952         FREE(untag_ptr(ret));
14953         if (get_jenv_res == JNI_EDETACHED) {
14954                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14955         }
14956         return ret_conv;
14957 }
14958 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
14959         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
14960         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14961 }
14962 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
14963         jclass c = (*env)->GetObjectClass(env, o);
14964         CHECK(c != NULL);
14965         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
14966         atomic_init(&calls->refcnt, 1);
14967         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14968         calls->o = (*env)->NewWeakGlobalRef(env, o);
14969         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
14970         CHECK(calls->persist_manager_meth != NULL);
14971         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
14972         CHECK(calls->persist_graph_meth != NULL);
14973         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
14974         CHECK(calls->persist_scorer_meth != NULL);
14975
14976         LDKPersister ret = {
14977                 .this_arg = (void*) calls,
14978                 .persist_manager = persist_manager_LDKPersister_jcall,
14979                 .persist_graph = persist_graph_LDKPersister_jcall,
14980                 .persist_scorer = persist_scorer_LDKPersister_jcall,
14981                 .free = LDKPersister_JCalls_free,
14982         };
14983         return ret;
14984 }
14985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
14986         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
14987         *res_ptr = LDKPersister_init(env, clz, o);
14988         return tag_ptr(res_ptr, true);
14989 }
14990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
14991         void* this_arg_ptr = untag_ptr(this_arg);
14992         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14993         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14994         LDKChannelManager channel_manager_conv;
14995         channel_manager_conv.inner = untag_ptr(channel_manager);
14996         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
14997         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
14998         channel_manager_conv.is_owned = false;
14999         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15000         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
15001         return tag_ptr(ret_conv, true);
15002 }
15003
15004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
15005         void* this_arg_ptr = untag_ptr(this_arg);
15006         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15007         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15008         LDKNetworkGraph network_graph_conv;
15009         network_graph_conv.inner = untag_ptr(network_graph);
15010         network_graph_conv.is_owned = ptr_is_owned(network_graph);
15011         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
15012         network_graph_conv.is_owned = false;
15013         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15014         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
15015         return tag_ptr(ret_conv, true);
15016 }
15017
15018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
15019         void* this_arg_ptr = untag_ptr(this_arg);
15020         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15021         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15022         void* scorer_ptr = untag_ptr(scorer);
15023         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
15024         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
15025         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15026         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
15027         return tag_ptr(ret_conv, true);
15028 }
15029
15030 typedef struct LDKPersist_JCalls {
15031         atomic_size_t refcnt;
15032         JavaVM *vm;
15033         jweak o;
15034         jmethodID persist_new_channel_meth;
15035         jmethodID update_persisted_channel_meth;
15036 } LDKPersist_JCalls;
15037 static void LDKPersist_JCalls_free(void* this_arg) {
15038         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15039         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15040                 JNIEnv *env;
15041                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15042                 if (get_jenv_res == JNI_EDETACHED) {
15043                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15044                 } else {
15045                         DO_ASSERT(get_jenv_res == JNI_OK);
15046                 }
15047                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15048                 if (get_jenv_res == JNI_EDETACHED) {
15049                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15050                 }
15051                 FREE(j_calls);
15052         }
15053 }
15054 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
15055         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15056         JNIEnv *env;
15057         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15058         if (get_jenv_res == JNI_EDETACHED) {
15059                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15060         } else {
15061                 DO_ASSERT(get_jenv_res == JNI_OK);
15062         }
15063         LDKOutPoint channel_id_var = channel_id;
15064         int64_t channel_id_ref = 0;
15065         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15066         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
15067         LDKChannelMonitor data_var = *data;
15068         int64_t data_ref = 0;
15069         data_var = ChannelMonitor_clone(&data_var);
15070         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
15071         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
15072         LDKMonitorUpdateId update_id_var = update_id;
15073         int64_t update_id_ref = 0;
15074         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
15075         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
15076         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15077         CHECK(obj != NULL);
15078         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
15079         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15080                 (*env)->ExceptionDescribe(env);
15081                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
15082         }
15083         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
15084         if (get_jenv_res == JNI_EDETACHED) {
15085                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15086         }
15087         return ret_conv;
15088 }
15089 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
15090         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15091         JNIEnv *env;
15092         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15093         if (get_jenv_res == JNI_EDETACHED) {
15094                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15095         } else {
15096                 DO_ASSERT(get_jenv_res == JNI_OK);
15097         }
15098         LDKOutPoint channel_id_var = channel_id;
15099         int64_t channel_id_ref = 0;
15100         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15101         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
15102         LDKChannelMonitorUpdate update_var = update;
15103         int64_t update_ref = 0;
15104         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
15105         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
15106         LDKChannelMonitor data_var = *data;
15107         int64_t data_ref = 0;
15108         data_var = ChannelMonitor_clone(&data_var);
15109         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
15110         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
15111         LDKMonitorUpdateId update_id_var = update_id;
15112         int64_t update_id_ref = 0;
15113         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
15114         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
15115         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15116         CHECK(obj != NULL);
15117         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
15118         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15119                 (*env)->ExceptionDescribe(env);
15120                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
15121         }
15122         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
15123         if (get_jenv_res == JNI_EDETACHED) {
15124                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15125         }
15126         return ret_conv;
15127 }
15128 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
15129         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
15130         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15131 }
15132 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
15133         jclass c = (*env)->GetObjectClass(env, o);
15134         CHECK(c != NULL);
15135         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
15136         atomic_init(&calls->refcnt, 1);
15137         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15138         calls->o = (*env)->NewWeakGlobalRef(env, o);
15139         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
15140         CHECK(calls->persist_new_channel_meth != NULL);
15141         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
15142         CHECK(calls->update_persisted_channel_meth != NULL);
15143
15144         LDKPersist ret = {
15145                 .this_arg = (void*) calls,
15146                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
15147                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
15148                 .free = LDKPersist_JCalls_free,
15149         };
15150         return ret;
15151 }
15152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
15153         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
15154         *res_ptr = LDKPersist_init(env, clz, o);
15155         return tag_ptr(res_ptr, true);
15156 }
15157 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
15158         void* this_arg_ptr = untag_ptr(this_arg);
15159         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15160         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
15161         LDKOutPoint channel_id_conv;
15162         channel_id_conv.inner = untag_ptr(channel_id);
15163         channel_id_conv.is_owned = ptr_is_owned(channel_id);
15164         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
15165         channel_id_conv = OutPoint_clone(&channel_id_conv);
15166         LDKChannelMonitor data_conv;
15167         data_conv.inner = untag_ptr(data);
15168         data_conv.is_owned = ptr_is_owned(data);
15169         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
15170         data_conv.is_owned = false;
15171         LDKMonitorUpdateId update_id_conv;
15172         update_id_conv.inner = untag_ptr(update_id);
15173         update_id_conv.is_owned = ptr_is_owned(update_id);
15174         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
15175         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
15176         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv));
15177         return ret_conv;
15178 }
15179
15180 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
15181         void* this_arg_ptr = untag_ptr(this_arg);
15182         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15183         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
15184         LDKOutPoint channel_id_conv;
15185         channel_id_conv.inner = untag_ptr(channel_id);
15186         channel_id_conv.is_owned = ptr_is_owned(channel_id);
15187         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
15188         channel_id_conv = OutPoint_clone(&channel_id_conv);
15189         LDKChannelMonitorUpdate update_conv;
15190         update_conv.inner = untag_ptr(update);
15191         update_conv.is_owned = ptr_is_owned(update);
15192         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
15193         update_conv = ChannelMonitorUpdate_clone(&update_conv);
15194         LDKChannelMonitor data_conv;
15195         data_conv.inner = untag_ptr(data);
15196         data_conv.is_owned = ptr_is_owned(data);
15197         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
15198         data_conv.is_owned = false;
15199         LDKMonitorUpdateId update_id_conv;
15200         update_id_conv.inner = untag_ptr(update_id);
15201         update_id_conv.is_owned = ptr_is_owned(update_id);
15202         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
15203         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
15204         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv));
15205         return ret_conv;
15206 }
15207
15208 typedef struct LDKFutureCallback_JCalls {
15209         atomic_size_t refcnt;
15210         JavaVM *vm;
15211         jweak o;
15212         jmethodID call_meth;
15213 } LDKFutureCallback_JCalls;
15214 static void LDKFutureCallback_JCalls_free(void* this_arg) {
15215         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15216         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15217                 JNIEnv *env;
15218                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15219                 if (get_jenv_res == JNI_EDETACHED) {
15220                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15221                 } else {
15222                         DO_ASSERT(get_jenv_res == JNI_OK);
15223                 }
15224                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15225                 if (get_jenv_res == JNI_EDETACHED) {
15226                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15227                 }
15228                 FREE(j_calls);
15229         }
15230 }
15231 void call_LDKFutureCallback_jcall(const void* this_arg) {
15232         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15233         JNIEnv *env;
15234         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15235         if (get_jenv_res == JNI_EDETACHED) {
15236                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15237         } else {
15238                 DO_ASSERT(get_jenv_res == JNI_OK);
15239         }
15240         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15241         CHECK(obj != NULL);
15242         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
15243         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15244                 (*env)->ExceptionDescribe(env);
15245                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
15246         }
15247         if (get_jenv_res == JNI_EDETACHED) {
15248                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15249         }
15250 }
15251 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
15252         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
15253         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15254 }
15255 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
15256         jclass c = (*env)->GetObjectClass(env, o);
15257         CHECK(c != NULL);
15258         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
15259         atomic_init(&calls->refcnt, 1);
15260         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15261         calls->o = (*env)->NewWeakGlobalRef(env, o);
15262         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
15263         CHECK(calls->call_meth != NULL);
15264
15265         LDKFutureCallback ret = {
15266                 .this_arg = (void*) calls,
15267                 .call = call_LDKFutureCallback_jcall,
15268                 .free = LDKFutureCallback_JCalls_free,
15269         };
15270         return ret;
15271 }
15272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
15273         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
15274         *res_ptr = LDKFutureCallback_init(env, clz, o);
15275         return tag_ptr(res_ptr, true);
15276 }
15277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
15278         void* this_arg_ptr = untag_ptr(this_arg);
15279         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15280         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
15281         (this_arg_conv->call)(this_arg_conv->this_arg);
15282 }
15283
15284 typedef struct LDKListen_JCalls {
15285         atomic_size_t refcnt;
15286         JavaVM *vm;
15287         jweak o;
15288         jmethodID filtered_block_connected_meth;
15289         jmethodID block_connected_meth;
15290         jmethodID block_disconnected_meth;
15291 } LDKListen_JCalls;
15292 static void LDKListen_JCalls_free(void* this_arg) {
15293         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15294         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15295                 JNIEnv *env;
15296                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15297                 if (get_jenv_res == JNI_EDETACHED) {
15298                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15299                 } else {
15300                         DO_ASSERT(get_jenv_res == JNI_OK);
15301                 }
15302                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15303                 if (get_jenv_res == JNI_EDETACHED) {
15304                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15305                 }
15306                 FREE(j_calls);
15307         }
15308 }
15309 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
15310         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15311         JNIEnv *env;
15312         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15313         if (get_jenv_res == JNI_EDETACHED) {
15314                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15315         } else {
15316                 DO_ASSERT(get_jenv_res == JNI_OK);
15317         }
15318         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15319         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15320         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
15321         int64_tArray txdata_arr = NULL;
15322         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
15323         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
15324         for (size_t c = 0; c < txdata_var.datalen; c++) {
15325                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15326                 *txdata_conv_28_conv = txdata_var.data[c];
15327                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
15328         }
15329         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
15330         FREE(txdata_var.data);
15331         int32_t height_conv = height;
15332         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15333         CHECK(obj != NULL);
15334         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
15335         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15336                 (*env)->ExceptionDescribe(env);
15337                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
15338         }
15339         if (get_jenv_res == JNI_EDETACHED) {
15340                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15341         }
15342 }
15343 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
15344         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15345         JNIEnv *env;
15346         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15347         if (get_jenv_res == JNI_EDETACHED) {
15348                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15349         } else {
15350                 DO_ASSERT(get_jenv_res == JNI_OK);
15351         }
15352         LDKu8slice block_var = block;
15353         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
15354         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
15355         int32_t height_conv = height;
15356         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15357         CHECK(obj != NULL);
15358         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
15359         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15360                 (*env)->ExceptionDescribe(env);
15361                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
15362         }
15363         if (get_jenv_res == JNI_EDETACHED) {
15364                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15365         }
15366 }
15367 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
15368         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15369         JNIEnv *env;
15370         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15371         if (get_jenv_res == JNI_EDETACHED) {
15372                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15373         } else {
15374                 DO_ASSERT(get_jenv_res == JNI_OK);
15375         }
15376         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15377         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15378         int32_t height_conv = height;
15379         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15380         CHECK(obj != NULL);
15381         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
15382         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15383                 (*env)->ExceptionDescribe(env);
15384                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
15385         }
15386         if (get_jenv_res == JNI_EDETACHED) {
15387                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15388         }
15389 }
15390 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
15391         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
15392         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15393 }
15394 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
15395         jclass c = (*env)->GetObjectClass(env, o);
15396         CHECK(c != NULL);
15397         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
15398         atomic_init(&calls->refcnt, 1);
15399         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15400         calls->o = (*env)->NewWeakGlobalRef(env, o);
15401         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
15402         CHECK(calls->filtered_block_connected_meth != NULL);
15403         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
15404         CHECK(calls->block_connected_meth != NULL);
15405         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
15406         CHECK(calls->block_disconnected_meth != NULL);
15407
15408         LDKListen ret = {
15409                 .this_arg = (void*) calls,
15410                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
15411                 .block_connected = block_connected_LDKListen_jcall,
15412                 .block_disconnected = block_disconnected_LDKListen_jcall,
15413                 .free = LDKListen_JCalls_free,
15414         };
15415         return ret;
15416 }
15417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
15418         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
15419         *res_ptr = LDKListen_init(env, clz, o);
15420         return tag_ptr(res_ptr, true);
15421 }
15422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1filtered_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
15423         void* this_arg_ptr = untag_ptr(this_arg);
15424         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15425         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15426         uint8_t header_arr[80];
15427         CHECK((*env)->GetArrayLength(env, header) == 80);
15428         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15429         uint8_t (*header_ref)[80] = &header_arr;
15430         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15431         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15432         if (txdata_constr.datalen > 0)
15433                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15434         else
15435                 txdata_constr.data = NULL;
15436         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15437         for (size_t c = 0; c < txdata_constr.datalen; c++) {
15438                 int64_t txdata_conv_28 = txdata_vals[c];
15439                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15440                 CHECK_ACCESS(txdata_conv_28_ptr);
15441                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15442                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15443                 txdata_constr.data[c] = txdata_conv_28_conv;
15444         }
15445         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15446         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15447 }
15448
15449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray block, int32_t height) {
15450         void* this_arg_ptr = untag_ptr(this_arg);
15451         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15452         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15453         LDKu8slice block_ref;
15454         block_ref.datalen = (*env)->GetArrayLength(env, block);
15455         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
15456         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
15457         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
15458 }
15459
15460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
15461         void* this_arg_ptr = untag_ptr(this_arg);
15462         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15463         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15464         uint8_t header_arr[80];
15465         CHECK((*env)->GetArrayLength(env, header) == 80);
15466         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15467         uint8_t (*header_ref)[80] = &header_arr;
15468         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
15469 }
15470
15471 typedef struct LDKConfirm_JCalls {
15472         atomic_size_t refcnt;
15473         JavaVM *vm;
15474         jweak o;
15475         jmethodID transactions_confirmed_meth;
15476         jmethodID transaction_unconfirmed_meth;
15477         jmethodID best_block_updated_meth;
15478         jmethodID get_relevant_txids_meth;
15479 } LDKConfirm_JCalls;
15480 static void LDKConfirm_JCalls_free(void* this_arg) {
15481         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15482         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15483                 JNIEnv *env;
15484                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15485                 if (get_jenv_res == JNI_EDETACHED) {
15486                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15487                 } else {
15488                         DO_ASSERT(get_jenv_res == JNI_OK);
15489                 }
15490                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15491                 if (get_jenv_res == JNI_EDETACHED) {
15492                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15493                 }
15494                 FREE(j_calls);
15495         }
15496 }
15497 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
15498         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15499         JNIEnv *env;
15500         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15501         if (get_jenv_res == JNI_EDETACHED) {
15502                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15503         } else {
15504                 DO_ASSERT(get_jenv_res == JNI_OK);
15505         }
15506         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15507         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15508         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
15509         int64_tArray txdata_arr = NULL;
15510         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
15511         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
15512         for (size_t c = 0; c < txdata_var.datalen; c++) {
15513                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15514                 *txdata_conv_28_conv = txdata_var.data[c];
15515                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
15516         }
15517         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
15518         FREE(txdata_var.data);
15519         int32_t height_conv = height;
15520         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15521         CHECK(obj != NULL);
15522         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
15523         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15524                 (*env)->ExceptionDescribe(env);
15525                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
15526         }
15527         if (get_jenv_res == JNI_EDETACHED) {
15528                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15529         }
15530 }
15531 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
15532         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15533         JNIEnv *env;
15534         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15535         if (get_jenv_res == JNI_EDETACHED) {
15536                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15537         } else {
15538                 DO_ASSERT(get_jenv_res == JNI_OK);
15539         }
15540         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
15541         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
15542         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15543         CHECK(obj != NULL);
15544         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
15545         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15546                 (*env)->ExceptionDescribe(env);
15547                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
15548         }
15549         if (get_jenv_res == JNI_EDETACHED) {
15550                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15551         }
15552 }
15553 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
15554         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15555         JNIEnv *env;
15556         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15557         if (get_jenv_res == JNI_EDETACHED) {
15558                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15559         } else {
15560                 DO_ASSERT(get_jenv_res == JNI_OK);
15561         }
15562         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15563         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15564         int32_t height_conv = height;
15565         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15566         CHECK(obj != NULL);
15567         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
15568         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15569                 (*env)->ExceptionDescribe(env);
15570                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
15571         }
15572         if (get_jenv_res == JNI_EDETACHED) {
15573                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15574         }
15575 }
15576 LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
15577         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15578         JNIEnv *env;
15579         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15580         if (get_jenv_res == JNI_EDETACHED) {
15581                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15582         } else {
15583                 DO_ASSERT(get_jenv_res == JNI_OK);
15584         }
15585         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15586         CHECK(obj != NULL);
15587         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
15588         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15589                 (*env)->ExceptionDescribe(env);
15590                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
15591         }
15592         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_constr;
15593         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
15594         if (ret_constr.datalen > 0)
15595                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
15596         else
15597                 ret_constr.data = NULL;
15598         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
15599         for (size_t x = 0; x < ret_constr.datalen; x++) {
15600                 int64_t ret_conv_49 = ret_vals[x];
15601                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
15602                 CHECK_ACCESS(ret_conv_49_ptr);
15603                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ ret_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(ret_conv_49_ptr);
15604                 FREE(untag_ptr(ret_conv_49));
15605                 ret_constr.data[x] = ret_conv_49_conv;
15606         }
15607         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
15608         if (get_jenv_res == JNI_EDETACHED) {
15609                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15610         }
15611         return ret_constr;
15612 }
15613 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
15614         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
15615         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15616 }
15617 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
15618         jclass c = (*env)->GetObjectClass(env, o);
15619         CHECK(c != NULL);
15620         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
15621         atomic_init(&calls->refcnt, 1);
15622         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15623         calls->o = (*env)->NewWeakGlobalRef(env, o);
15624         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
15625         CHECK(calls->transactions_confirmed_meth != NULL);
15626         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
15627         CHECK(calls->transaction_unconfirmed_meth != NULL);
15628         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
15629         CHECK(calls->best_block_updated_meth != NULL);
15630         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
15631         CHECK(calls->get_relevant_txids_meth != NULL);
15632
15633         LDKConfirm ret = {
15634                 .this_arg = (void*) calls,
15635                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
15636                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
15637                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
15638                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
15639                 .free = LDKConfirm_JCalls_free,
15640         };
15641         return ret;
15642 }
15643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
15644         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15645         *res_ptr = LDKConfirm_init(env, clz, o);
15646         return tag_ptr(res_ptr, true);
15647 }
15648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
15649         void* this_arg_ptr = untag_ptr(this_arg);
15650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15651         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15652         uint8_t header_arr[80];
15653         CHECK((*env)->GetArrayLength(env, header) == 80);
15654         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15655         uint8_t (*header_ref)[80] = &header_arr;
15656         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15657         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15658         if (txdata_constr.datalen > 0)
15659                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15660         else
15661                 txdata_constr.data = NULL;
15662         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15663         for (size_t c = 0; c < txdata_constr.datalen; c++) {
15664                 int64_t txdata_conv_28 = txdata_vals[c];
15665                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15666                 CHECK_ACCESS(txdata_conv_28_ptr);
15667                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15668                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15669                 txdata_constr.data[c] = txdata_conv_28_conv;
15670         }
15671         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15672         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15673 }
15674
15675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
15676         void* this_arg_ptr = untag_ptr(this_arg);
15677         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15678         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15679         uint8_t txid_arr[32];
15680         CHECK((*env)->GetArrayLength(env, txid) == 32);
15681         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
15682         uint8_t (*txid_ref)[32] = &txid_arr;
15683         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
15684 }
15685
15686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
15687         void* this_arg_ptr = untag_ptr(this_arg);
15688         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15689         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15690         uint8_t header_arr[80];
15691         CHECK((*env)->GetArrayLength(env, header) == 80);
15692         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15693         uint8_t (*header_ref)[80] = &header_arr;
15694         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
15695 }
15696
15697 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
15698         void* this_arg_ptr = untag_ptr(this_arg);
15699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15700         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15701         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
15702         int64_tArray ret_arr = NULL;
15703         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15704         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15705         for (size_t x = 0; x < ret_var.datalen; x++) {
15706                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
15707                 *ret_conv_49_conv = ret_var.data[x];
15708                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
15709         }
15710         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15711         FREE(ret_var.data);
15712         return ret_arr;
15713 }
15714
15715 typedef struct LDKEventHandler_JCalls {
15716         atomic_size_t refcnt;
15717         JavaVM *vm;
15718         jweak o;
15719         jmethodID handle_event_meth;
15720 } LDKEventHandler_JCalls;
15721 static void LDKEventHandler_JCalls_free(void* this_arg) {
15722         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15723         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15724                 JNIEnv *env;
15725                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15726                 if (get_jenv_res == JNI_EDETACHED) {
15727                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15728                 } else {
15729                         DO_ASSERT(get_jenv_res == JNI_OK);
15730                 }
15731                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15732                 if (get_jenv_res == JNI_EDETACHED) {
15733                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15734                 }
15735                 FREE(j_calls);
15736         }
15737 }
15738 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
15739         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15740         JNIEnv *env;
15741         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15742         if (get_jenv_res == JNI_EDETACHED) {
15743                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15744         } else {
15745                 DO_ASSERT(get_jenv_res == JNI_OK);
15746         }
15747         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15748         *event_copy = event;
15749         int64_t event_ref = tag_ptr(event_copy, true);
15750         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15751         CHECK(obj != NULL);
15752         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
15753         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15754                 (*env)->ExceptionDescribe(env);
15755                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
15756         }
15757         if (get_jenv_res == JNI_EDETACHED) {
15758                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15759         }
15760 }
15761 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
15762         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
15763         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15764 }
15765 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
15766         jclass c = (*env)->GetObjectClass(env, o);
15767         CHECK(c != NULL);
15768         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
15769         atomic_init(&calls->refcnt, 1);
15770         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15771         calls->o = (*env)->NewWeakGlobalRef(env, o);
15772         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
15773         CHECK(calls->handle_event_meth != NULL);
15774
15775         LDKEventHandler ret = {
15776                 .this_arg = (void*) calls,
15777                 .handle_event = handle_event_LDKEventHandler_jcall,
15778                 .free = LDKEventHandler_JCalls_free,
15779         };
15780         return ret;
15781 }
15782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
15783         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15784         *res_ptr = LDKEventHandler_init(env, clz, o);
15785         return tag_ptr(res_ptr, true);
15786 }
15787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
15788         void* this_arg_ptr = untag_ptr(this_arg);
15789         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15790         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
15791         void* event_ptr = untag_ptr(event);
15792         CHECK_ACCESS(event_ptr);
15793         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
15794         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
15795         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
15796 }
15797
15798 typedef struct LDKEventsProvider_JCalls {
15799         atomic_size_t refcnt;
15800         JavaVM *vm;
15801         jweak o;
15802         jmethodID process_pending_events_meth;
15803 } LDKEventsProvider_JCalls;
15804 static void LDKEventsProvider_JCalls_free(void* this_arg) {
15805         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15806         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15807                 JNIEnv *env;
15808                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15809                 if (get_jenv_res == JNI_EDETACHED) {
15810                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15811                 } else {
15812                         DO_ASSERT(get_jenv_res == JNI_OK);
15813                 }
15814                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15815                 if (get_jenv_res == JNI_EDETACHED) {
15816                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15817                 }
15818                 FREE(j_calls);
15819         }
15820 }
15821 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
15822         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15823         JNIEnv *env;
15824         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15825         if (get_jenv_res == JNI_EDETACHED) {
15826                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15827         } else {
15828                 DO_ASSERT(get_jenv_res == JNI_OK);
15829         }
15830         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15831         *handler_ret = handler;
15832         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15833         CHECK(obj != NULL);
15834         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
15835         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15836                 (*env)->ExceptionDescribe(env);
15837                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
15838         }
15839         if (get_jenv_res == JNI_EDETACHED) {
15840                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15841         }
15842 }
15843 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
15844         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
15845         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15846 }
15847 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
15848         jclass c = (*env)->GetObjectClass(env, o);
15849         CHECK(c != NULL);
15850         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
15851         atomic_init(&calls->refcnt, 1);
15852         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15853         calls->o = (*env)->NewWeakGlobalRef(env, o);
15854         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
15855         CHECK(calls->process_pending_events_meth != NULL);
15856
15857         LDKEventsProvider ret = {
15858                 .this_arg = (void*) calls,
15859                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
15860                 .free = LDKEventsProvider_JCalls_free,
15861         };
15862         return ret;
15863 }
15864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
15865         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15866         *res_ptr = LDKEventsProvider_init(env, clz, o);
15867         return tag_ptr(res_ptr, true);
15868 }
15869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
15870         void* this_arg_ptr = untag_ptr(this_arg);
15871         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15872         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
15873         void* handler_ptr = untag_ptr(handler);
15874         CHECK_ACCESS(handler_ptr);
15875         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
15876         if (handler_conv.free == LDKEventHandler_JCalls_free) {
15877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15878                 LDKEventHandler_JCalls_cloned(&handler_conv);
15879         }
15880         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
15881 }
15882
15883 static jclass LDKFailureCode_TemporaryNodeFailure_class = NULL;
15884 static jmethodID LDKFailureCode_TemporaryNodeFailure_meth = NULL;
15885 static jclass LDKFailureCode_RequiredNodeFeatureMissing_class = NULL;
15886 static jmethodID LDKFailureCode_RequiredNodeFeatureMissing_meth = NULL;
15887 static jclass LDKFailureCode_IncorrectOrUnknownPaymentDetails_class = NULL;
15888 static jmethodID LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = NULL;
15889 static jclass LDKFailureCode_InvalidOnionPayload_class = NULL;
15890 static jmethodID LDKFailureCode_InvalidOnionPayload_meth = NULL;
15891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFailureCode_init (JNIEnv *env, jclass clz) {
15892         LDKFailureCode_TemporaryNodeFailure_class =
15893                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$TemporaryNodeFailure"));
15894         CHECK(LDKFailureCode_TemporaryNodeFailure_class != NULL);
15895         LDKFailureCode_TemporaryNodeFailure_meth = (*env)->GetMethodID(env, LDKFailureCode_TemporaryNodeFailure_class, "<init>", "()V");
15896         CHECK(LDKFailureCode_TemporaryNodeFailure_meth != NULL);
15897         LDKFailureCode_RequiredNodeFeatureMissing_class =
15898                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$RequiredNodeFeatureMissing"));
15899         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_class != NULL);
15900         LDKFailureCode_RequiredNodeFeatureMissing_meth = (*env)->GetMethodID(env, LDKFailureCode_RequiredNodeFeatureMissing_class, "<init>", "()V");
15901         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_meth != NULL);
15902         LDKFailureCode_IncorrectOrUnknownPaymentDetails_class =
15903                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$IncorrectOrUnknownPaymentDetails"));
15904         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_class != NULL);
15905         LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = (*env)->GetMethodID(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, "<init>", "()V");
15906         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth != NULL);
15907         LDKFailureCode_InvalidOnionPayload_class =
15908                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$InvalidOnionPayload"));
15909         CHECK(LDKFailureCode_InvalidOnionPayload_class != NULL);
15910         LDKFailureCode_InvalidOnionPayload_meth = (*env)->GetMethodID(env, LDKFailureCode_InvalidOnionPayload_class, "<init>", "(J)V");
15911         CHECK(LDKFailureCode_InvalidOnionPayload_meth != NULL);
15912 }
15913 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFailureCode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15914         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
15915         switch(obj->tag) {
15916                 case LDKFailureCode_TemporaryNodeFailure: {
15917                         return (*env)->NewObject(env, LDKFailureCode_TemporaryNodeFailure_class, LDKFailureCode_TemporaryNodeFailure_meth);
15918                 }
15919                 case LDKFailureCode_RequiredNodeFeatureMissing: {
15920                         return (*env)->NewObject(env, LDKFailureCode_RequiredNodeFeatureMissing_class, LDKFailureCode_RequiredNodeFeatureMissing_meth);
15921                 }
15922                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: {
15923                         return (*env)->NewObject(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth);
15924                 }
15925                 case LDKFailureCode_InvalidOnionPayload: {
15926                         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
15927                         return (*env)->NewObject(env, LDKFailureCode_InvalidOnionPayload_class, LDKFailureCode_InvalidOnionPayload_meth, invalid_onion_payload_ref);
15928                 }
15929                 default: abort();
15930         }
15931 }
15932 typedef struct LDKMessageSendEventsProvider_JCalls {
15933         atomic_size_t refcnt;
15934         JavaVM *vm;
15935         jweak o;
15936         jmethodID get_and_clear_pending_msg_events_meth;
15937 } LDKMessageSendEventsProvider_JCalls;
15938 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
15939         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15940         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15941                 JNIEnv *env;
15942                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15943                 if (get_jenv_res == JNI_EDETACHED) {
15944                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15945                 } else {
15946                         DO_ASSERT(get_jenv_res == JNI_OK);
15947                 }
15948                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15949                 if (get_jenv_res == JNI_EDETACHED) {
15950                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15951                 }
15952                 FREE(j_calls);
15953         }
15954 }
15955 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
15956         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15957         JNIEnv *env;
15958         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15959         if (get_jenv_res == JNI_EDETACHED) {
15960                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15961         } else {
15962                 DO_ASSERT(get_jenv_res == JNI_OK);
15963         }
15964         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15965         CHECK(obj != NULL);
15966         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
15967         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15968                 (*env)->ExceptionDescribe(env);
15969                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
15970         }
15971         LDKCVec_MessageSendEventZ ret_constr;
15972         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
15973         if (ret_constr.datalen > 0)
15974                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15975         else
15976                 ret_constr.data = NULL;
15977         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
15978         for (size_t s = 0; s < ret_constr.datalen; s++) {
15979                 int64_t ret_conv_18 = ret_vals[s];
15980                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
15981                 CHECK_ACCESS(ret_conv_18_ptr);
15982                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
15983                 FREE(untag_ptr(ret_conv_18));
15984                 ret_constr.data[s] = ret_conv_18_conv;
15985         }
15986         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
15987         if (get_jenv_res == JNI_EDETACHED) {
15988                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15989         }
15990         return ret_constr;
15991 }
15992 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
15993         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
15994         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15995 }
15996 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
15997         jclass c = (*env)->GetObjectClass(env, o);
15998         CHECK(c != NULL);
15999         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
16000         atomic_init(&calls->refcnt, 1);
16001         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16002         calls->o = (*env)->NewWeakGlobalRef(env, o);
16003         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
16004         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
16005
16006         LDKMessageSendEventsProvider ret = {
16007                 .this_arg = (void*) calls,
16008                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
16009                 .free = LDKMessageSendEventsProvider_JCalls_free,
16010         };
16011         return ret;
16012 }
16013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
16014         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16015         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
16016         return tag_ptr(res_ptr, true);
16017 }
16018 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16019         void* this_arg_ptr = untag_ptr(this_arg);
16020         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16021         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
16022         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
16023         int64_tArray ret_arr = NULL;
16024         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16025         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16026         for (size_t s = 0; s < ret_var.datalen; s++) {
16027                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16028                 *ret_conv_18_copy = ret_var.data[s];
16029                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
16030                 ret_arr_ptr[s] = ret_conv_18_ref;
16031         }
16032         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16033         FREE(ret_var.data);
16034         return ret_arr;
16035 }
16036
16037 typedef struct LDKChannelMessageHandler_JCalls {
16038         atomic_size_t refcnt;
16039         JavaVM *vm;
16040         jweak o;
16041         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16042         jmethodID handle_open_channel_meth;
16043         jmethodID handle_open_channel_v2_meth;
16044         jmethodID handle_accept_channel_meth;
16045         jmethodID handle_accept_channel_v2_meth;
16046         jmethodID handle_funding_created_meth;
16047         jmethodID handle_funding_signed_meth;
16048         jmethodID handle_channel_ready_meth;
16049         jmethodID handle_shutdown_meth;
16050         jmethodID handle_closing_signed_meth;
16051         jmethodID handle_tx_add_input_meth;
16052         jmethodID handle_tx_add_output_meth;
16053         jmethodID handle_tx_remove_input_meth;
16054         jmethodID handle_tx_remove_output_meth;
16055         jmethodID handle_tx_complete_meth;
16056         jmethodID handle_tx_signatures_meth;
16057         jmethodID handle_tx_init_rbf_meth;
16058         jmethodID handle_tx_ack_rbf_meth;
16059         jmethodID handle_tx_abort_meth;
16060         jmethodID handle_update_add_htlc_meth;
16061         jmethodID handle_update_fulfill_htlc_meth;
16062         jmethodID handle_update_fail_htlc_meth;
16063         jmethodID handle_update_fail_malformed_htlc_meth;
16064         jmethodID handle_commitment_signed_meth;
16065         jmethodID handle_revoke_and_ack_meth;
16066         jmethodID handle_update_fee_meth;
16067         jmethodID handle_announcement_signatures_meth;
16068         jmethodID peer_disconnected_meth;
16069         jmethodID peer_connected_meth;
16070         jmethodID handle_channel_reestablish_meth;
16071         jmethodID handle_channel_update_meth;
16072         jmethodID handle_error_meth;
16073         jmethodID provided_node_features_meth;
16074         jmethodID provided_init_features_meth;
16075         jmethodID get_genesis_hashes_meth;
16076 } LDKChannelMessageHandler_JCalls;
16077 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
16078         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16079         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16080                 JNIEnv *env;
16081                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16082                 if (get_jenv_res == JNI_EDETACHED) {
16083                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16084                 } else {
16085                         DO_ASSERT(get_jenv_res == JNI_OK);
16086                 }
16087                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16088                 if (get_jenv_res == JNI_EDETACHED) {
16089                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16090                 }
16091                 FREE(j_calls);
16092         }
16093 }
16094 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
16095         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16096         JNIEnv *env;
16097         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16098         if (get_jenv_res == JNI_EDETACHED) {
16099                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16100         } else {
16101                 DO_ASSERT(get_jenv_res == JNI_OK);
16102         }
16103         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16104         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16105         LDKOpenChannel msg_var = *msg;
16106         int64_t msg_ref = 0;
16107         msg_var = OpenChannel_clone(&msg_var);
16108         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16109         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16110         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16111         CHECK(obj != NULL);
16112         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
16113         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16114                 (*env)->ExceptionDescribe(env);
16115                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
16116         }
16117         if (get_jenv_res == JNI_EDETACHED) {
16118                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16119         }
16120 }
16121 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
16122         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16123         JNIEnv *env;
16124         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16125         if (get_jenv_res == JNI_EDETACHED) {
16126                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16127         } else {
16128                 DO_ASSERT(get_jenv_res == JNI_OK);
16129         }
16130         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16131         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16132         LDKOpenChannelV2 msg_var = *msg;
16133         int64_t msg_ref = 0;
16134         msg_var = OpenChannelV2_clone(&msg_var);
16135         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16136         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16137         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16138         CHECK(obj != NULL);
16139         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
16140         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16141                 (*env)->ExceptionDescribe(env);
16142                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
16143         }
16144         if (get_jenv_res == JNI_EDETACHED) {
16145                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16146         }
16147 }
16148 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
16149         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16150         JNIEnv *env;
16151         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16152         if (get_jenv_res == JNI_EDETACHED) {
16153                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16154         } else {
16155                 DO_ASSERT(get_jenv_res == JNI_OK);
16156         }
16157         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16158         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16159         LDKAcceptChannel msg_var = *msg;
16160         int64_t msg_ref = 0;
16161         msg_var = AcceptChannel_clone(&msg_var);
16162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16163         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16164         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16165         CHECK(obj != NULL);
16166         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
16167         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16168                 (*env)->ExceptionDescribe(env);
16169                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
16170         }
16171         if (get_jenv_res == JNI_EDETACHED) {
16172                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16173         }
16174 }
16175 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
16176         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16177         JNIEnv *env;
16178         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16179         if (get_jenv_res == JNI_EDETACHED) {
16180                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16181         } else {
16182                 DO_ASSERT(get_jenv_res == JNI_OK);
16183         }
16184         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16185         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16186         LDKAcceptChannelV2 msg_var = *msg;
16187         int64_t msg_ref = 0;
16188         msg_var = AcceptChannelV2_clone(&msg_var);
16189         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16190         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16191         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16192         CHECK(obj != NULL);
16193         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
16194         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16195                 (*env)->ExceptionDescribe(env);
16196                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
16197         }
16198         if (get_jenv_res == JNI_EDETACHED) {
16199                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16200         }
16201 }
16202 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
16203         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16204         JNIEnv *env;
16205         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16206         if (get_jenv_res == JNI_EDETACHED) {
16207                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16208         } else {
16209                 DO_ASSERT(get_jenv_res == JNI_OK);
16210         }
16211         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16212         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16213         LDKFundingCreated msg_var = *msg;
16214         int64_t msg_ref = 0;
16215         msg_var = FundingCreated_clone(&msg_var);
16216         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16217         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16218         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16219         CHECK(obj != NULL);
16220         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
16221         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16222                 (*env)->ExceptionDescribe(env);
16223                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
16224         }
16225         if (get_jenv_res == JNI_EDETACHED) {
16226                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16227         }
16228 }
16229 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
16230         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16231         JNIEnv *env;
16232         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16233         if (get_jenv_res == JNI_EDETACHED) {
16234                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16235         } else {
16236                 DO_ASSERT(get_jenv_res == JNI_OK);
16237         }
16238         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16239         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16240         LDKFundingSigned msg_var = *msg;
16241         int64_t msg_ref = 0;
16242         msg_var = FundingSigned_clone(&msg_var);
16243         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16244         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16245         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16246         CHECK(obj != NULL);
16247         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
16248         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16249                 (*env)->ExceptionDescribe(env);
16250                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
16251         }
16252         if (get_jenv_res == JNI_EDETACHED) {
16253                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16254         }
16255 }
16256 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
16257         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16258         JNIEnv *env;
16259         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16260         if (get_jenv_res == JNI_EDETACHED) {
16261                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16262         } else {
16263                 DO_ASSERT(get_jenv_res == JNI_OK);
16264         }
16265         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16266         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16267         LDKChannelReady msg_var = *msg;
16268         int64_t msg_ref = 0;
16269         msg_var = ChannelReady_clone(&msg_var);
16270         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16271         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16272         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16273         CHECK(obj != NULL);
16274         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
16275         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16276                 (*env)->ExceptionDescribe(env);
16277                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
16278         }
16279         if (get_jenv_res == JNI_EDETACHED) {
16280                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16281         }
16282 }
16283 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
16284         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16285         JNIEnv *env;
16286         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16287         if (get_jenv_res == JNI_EDETACHED) {
16288                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16289         } else {
16290                 DO_ASSERT(get_jenv_res == JNI_OK);
16291         }
16292         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16293         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16294         LDKShutdown msg_var = *msg;
16295         int64_t msg_ref = 0;
16296         msg_var = Shutdown_clone(&msg_var);
16297         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16298         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16299         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16300         CHECK(obj != NULL);
16301         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
16302         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16303                 (*env)->ExceptionDescribe(env);
16304                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
16305         }
16306         if (get_jenv_res == JNI_EDETACHED) {
16307                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16308         }
16309 }
16310 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
16311         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16312         JNIEnv *env;
16313         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16314         if (get_jenv_res == JNI_EDETACHED) {
16315                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16316         } else {
16317                 DO_ASSERT(get_jenv_res == JNI_OK);
16318         }
16319         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16320         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16321         LDKClosingSigned msg_var = *msg;
16322         int64_t msg_ref = 0;
16323         msg_var = ClosingSigned_clone(&msg_var);
16324         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16325         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16326         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16327         CHECK(obj != NULL);
16328         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
16329         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16330                 (*env)->ExceptionDescribe(env);
16331                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
16332         }
16333         if (get_jenv_res == JNI_EDETACHED) {
16334                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16335         }
16336 }
16337 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
16338         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16339         JNIEnv *env;
16340         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16341         if (get_jenv_res == JNI_EDETACHED) {
16342                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16343         } else {
16344                 DO_ASSERT(get_jenv_res == JNI_OK);
16345         }
16346         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16347         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16348         LDKTxAddInput msg_var = *msg;
16349         int64_t msg_ref = 0;
16350         msg_var = TxAddInput_clone(&msg_var);
16351         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16352         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16353         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16354         CHECK(obj != NULL);
16355         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
16356         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16357                 (*env)->ExceptionDescribe(env);
16358                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
16359         }
16360         if (get_jenv_res == JNI_EDETACHED) {
16361                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16362         }
16363 }
16364 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
16365         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16366         JNIEnv *env;
16367         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16368         if (get_jenv_res == JNI_EDETACHED) {
16369                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16370         } else {
16371                 DO_ASSERT(get_jenv_res == JNI_OK);
16372         }
16373         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16374         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16375         LDKTxAddOutput msg_var = *msg;
16376         int64_t msg_ref = 0;
16377         msg_var = TxAddOutput_clone(&msg_var);
16378         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16379         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16380         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16381         CHECK(obj != NULL);
16382         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
16383         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16384                 (*env)->ExceptionDescribe(env);
16385                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
16386         }
16387         if (get_jenv_res == JNI_EDETACHED) {
16388                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16389         }
16390 }
16391 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
16392         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16393         JNIEnv *env;
16394         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16395         if (get_jenv_res == JNI_EDETACHED) {
16396                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16397         } else {
16398                 DO_ASSERT(get_jenv_res == JNI_OK);
16399         }
16400         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16401         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16402         LDKTxRemoveInput msg_var = *msg;
16403         int64_t msg_ref = 0;
16404         msg_var = TxRemoveInput_clone(&msg_var);
16405         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16406         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16407         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16408         CHECK(obj != NULL);
16409         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
16410         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16411                 (*env)->ExceptionDescribe(env);
16412                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
16413         }
16414         if (get_jenv_res == JNI_EDETACHED) {
16415                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16416         }
16417 }
16418 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
16419         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16420         JNIEnv *env;
16421         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16422         if (get_jenv_res == JNI_EDETACHED) {
16423                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16424         } else {
16425                 DO_ASSERT(get_jenv_res == JNI_OK);
16426         }
16427         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16428         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16429         LDKTxRemoveOutput msg_var = *msg;
16430         int64_t msg_ref = 0;
16431         msg_var = TxRemoveOutput_clone(&msg_var);
16432         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16433         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16434         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16435         CHECK(obj != NULL);
16436         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
16437         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16438                 (*env)->ExceptionDescribe(env);
16439                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
16440         }
16441         if (get_jenv_res == JNI_EDETACHED) {
16442                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16443         }
16444 }
16445 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
16446         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16447         JNIEnv *env;
16448         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16449         if (get_jenv_res == JNI_EDETACHED) {
16450                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16451         } else {
16452                 DO_ASSERT(get_jenv_res == JNI_OK);
16453         }
16454         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16455         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16456         LDKTxComplete msg_var = *msg;
16457         int64_t msg_ref = 0;
16458         msg_var = TxComplete_clone(&msg_var);
16459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16460         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16461         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16462         CHECK(obj != NULL);
16463         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
16464         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16465                 (*env)->ExceptionDescribe(env);
16466                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
16467         }
16468         if (get_jenv_res == JNI_EDETACHED) {
16469                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16470         }
16471 }
16472 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
16473         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16474         JNIEnv *env;
16475         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16476         if (get_jenv_res == JNI_EDETACHED) {
16477                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16478         } else {
16479                 DO_ASSERT(get_jenv_res == JNI_OK);
16480         }
16481         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16482         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16483         LDKTxSignatures msg_var = *msg;
16484         int64_t msg_ref = 0;
16485         msg_var = TxSignatures_clone(&msg_var);
16486         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16487         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16488         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16489         CHECK(obj != NULL);
16490         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
16491         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16492                 (*env)->ExceptionDescribe(env);
16493                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler from rust threw an exception.");
16494         }
16495         if (get_jenv_res == JNI_EDETACHED) {
16496                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16497         }
16498 }
16499 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
16500         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16501         JNIEnv *env;
16502         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16503         if (get_jenv_res == JNI_EDETACHED) {
16504                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16505         } else {
16506                 DO_ASSERT(get_jenv_res == JNI_OK);
16507         }
16508         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16509         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16510         LDKTxInitRbf msg_var = *msg;
16511         int64_t msg_ref = 0;
16512         msg_var = TxInitRbf_clone(&msg_var);
16513         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16514         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16515         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16516         CHECK(obj != NULL);
16517         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
16518         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16519                 (*env)->ExceptionDescribe(env);
16520                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
16521         }
16522         if (get_jenv_res == JNI_EDETACHED) {
16523                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16524         }
16525 }
16526 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
16527         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16528         JNIEnv *env;
16529         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16530         if (get_jenv_res == JNI_EDETACHED) {
16531                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16532         } else {
16533                 DO_ASSERT(get_jenv_res == JNI_OK);
16534         }
16535         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16536         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16537         LDKTxAckRbf msg_var = *msg;
16538         int64_t msg_ref = 0;
16539         msg_var = TxAckRbf_clone(&msg_var);
16540         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16541         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16542         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16543         CHECK(obj != NULL);
16544         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
16545         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16546                 (*env)->ExceptionDescribe(env);
16547                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
16548         }
16549         if (get_jenv_res == JNI_EDETACHED) {
16550                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16551         }
16552 }
16553 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
16554         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16555         JNIEnv *env;
16556         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16557         if (get_jenv_res == JNI_EDETACHED) {
16558                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16559         } else {
16560                 DO_ASSERT(get_jenv_res == JNI_OK);
16561         }
16562         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16563         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16564         LDKTxAbort msg_var = *msg;
16565         int64_t msg_ref = 0;
16566         msg_var = TxAbort_clone(&msg_var);
16567         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16568         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16569         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16570         CHECK(obj != NULL);
16571         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
16572         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16573                 (*env)->ExceptionDescribe(env);
16574                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
16575         }
16576         if (get_jenv_res == JNI_EDETACHED) {
16577                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16578         }
16579 }
16580 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
16581         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16582         JNIEnv *env;
16583         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16584         if (get_jenv_res == JNI_EDETACHED) {
16585                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16586         } else {
16587                 DO_ASSERT(get_jenv_res == JNI_OK);
16588         }
16589         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16590         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16591         LDKUpdateAddHTLC msg_var = *msg;
16592         int64_t msg_ref = 0;
16593         msg_var = UpdateAddHTLC_clone(&msg_var);
16594         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16595         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16596         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16597         CHECK(obj != NULL);
16598         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
16599         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16600                 (*env)->ExceptionDescribe(env);
16601                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
16602         }
16603         if (get_jenv_res == JNI_EDETACHED) {
16604                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16605         }
16606 }
16607 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
16608         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16609         JNIEnv *env;
16610         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16611         if (get_jenv_res == JNI_EDETACHED) {
16612                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16613         } else {
16614                 DO_ASSERT(get_jenv_res == JNI_OK);
16615         }
16616         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16617         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16618         LDKUpdateFulfillHTLC msg_var = *msg;
16619         int64_t msg_ref = 0;
16620         msg_var = UpdateFulfillHTLC_clone(&msg_var);
16621         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16622         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16623         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16624         CHECK(obj != NULL);
16625         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
16626         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16627                 (*env)->ExceptionDescribe(env);
16628                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
16629         }
16630         if (get_jenv_res == JNI_EDETACHED) {
16631                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16632         }
16633 }
16634 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
16635         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16636         JNIEnv *env;
16637         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16638         if (get_jenv_res == JNI_EDETACHED) {
16639                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16640         } else {
16641                 DO_ASSERT(get_jenv_res == JNI_OK);
16642         }
16643         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16644         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16645         LDKUpdateFailHTLC msg_var = *msg;
16646         int64_t msg_ref = 0;
16647         msg_var = UpdateFailHTLC_clone(&msg_var);
16648         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16649         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16650         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16651         CHECK(obj != NULL);
16652         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
16653         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16654                 (*env)->ExceptionDescribe(env);
16655                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
16656         }
16657         if (get_jenv_res == JNI_EDETACHED) {
16658                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16659         }
16660 }
16661 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
16662         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16663         JNIEnv *env;
16664         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16665         if (get_jenv_res == JNI_EDETACHED) {
16666                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16667         } else {
16668                 DO_ASSERT(get_jenv_res == JNI_OK);
16669         }
16670         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16671         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16672         LDKUpdateFailMalformedHTLC msg_var = *msg;
16673         int64_t msg_ref = 0;
16674         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
16675         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16676         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16677         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16678         CHECK(obj != NULL);
16679         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
16680         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16681                 (*env)->ExceptionDescribe(env);
16682                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
16683         }
16684         if (get_jenv_res == JNI_EDETACHED) {
16685                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16686         }
16687 }
16688 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
16689         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16690         JNIEnv *env;
16691         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16692         if (get_jenv_res == JNI_EDETACHED) {
16693                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16694         } else {
16695                 DO_ASSERT(get_jenv_res == JNI_OK);
16696         }
16697         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16698         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16699         LDKCommitmentSigned msg_var = *msg;
16700         int64_t msg_ref = 0;
16701         msg_var = CommitmentSigned_clone(&msg_var);
16702         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16703         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16704         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16705         CHECK(obj != NULL);
16706         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
16707         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16708                 (*env)->ExceptionDescribe(env);
16709                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
16710         }
16711         if (get_jenv_res == JNI_EDETACHED) {
16712                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16713         }
16714 }
16715 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
16716         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16717         JNIEnv *env;
16718         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16719         if (get_jenv_res == JNI_EDETACHED) {
16720                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16721         } else {
16722                 DO_ASSERT(get_jenv_res == JNI_OK);
16723         }
16724         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16725         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16726         LDKRevokeAndACK msg_var = *msg;
16727         int64_t msg_ref = 0;
16728         msg_var = RevokeAndACK_clone(&msg_var);
16729         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16730         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16731         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16732         CHECK(obj != NULL);
16733         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
16734         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16735                 (*env)->ExceptionDescribe(env);
16736                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
16737         }
16738         if (get_jenv_res == JNI_EDETACHED) {
16739                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16740         }
16741 }
16742 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
16743         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16744         JNIEnv *env;
16745         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16746         if (get_jenv_res == JNI_EDETACHED) {
16747                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16748         } else {
16749                 DO_ASSERT(get_jenv_res == JNI_OK);
16750         }
16751         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16752         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16753         LDKUpdateFee msg_var = *msg;
16754         int64_t msg_ref = 0;
16755         msg_var = UpdateFee_clone(&msg_var);
16756         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16757         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16758         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16759         CHECK(obj != NULL);
16760         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
16761         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16762                 (*env)->ExceptionDescribe(env);
16763                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
16764         }
16765         if (get_jenv_res == JNI_EDETACHED) {
16766                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16767         }
16768 }
16769 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
16770         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16771         JNIEnv *env;
16772         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16773         if (get_jenv_res == JNI_EDETACHED) {
16774                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16775         } else {
16776                 DO_ASSERT(get_jenv_res == JNI_OK);
16777         }
16778         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16779         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16780         LDKAnnouncementSignatures msg_var = *msg;
16781         int64_t msg_ref = 0;
16782         msg_var = AnnouncementSignatures_clone(&msg_var);
16783         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16784         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16785         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16786         CHECK(obj != NULL);
16787         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
16788         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16789                 (*env)->ExceptionDescribe(env);
16790                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
16791         }
16792         if (get_jenv_res == JNI_EDETACHED) {
16793                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16794         }
16795 }
16796 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16797         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16798         JNIEnv *env;
16799         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16800         if (get_jenv_res == JNI_EDETACHED) {
16801                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16802         } else {
16803                 DO_ASSERT(get_jenv_res == JNI_OK);
16804         }
16805         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16806         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16807         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16808         CHECK(obj != NULL);
16809         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
16810         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16811                 (*env)->ExceptionDescribe(env);
16812                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
16813         }
16814         if (get_jenv_res == JNI_EDETACHED) {
16815                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16816         }
16817 }
16818 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
16819         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16820         JNIEnv *env;
16821         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16822         if (get_jenv_res == JNI_EDETACHED) {
16823                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16824         } else {
16825                 DO_ASSERT(get_jenv_res == JNI_OK);
16826         }
16827         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16828         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16829         LDKInit msg_var = *msg;
16830         int64_t msg_ref = 0;
16831         msg_var = Init_clone(&msg_var);
16832         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16833         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16834         jboolean inbound_conv = inbound;
16835         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16836         CHECK(obj != NULL);
16837         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
16838         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16839                 (*env)->ExceptionDescribe(env);
16840                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
16841         }
16842         void* ret_ptr = untag_ptr(ret);
16843         CHECK_ACCESS(ret_ptr);
16844         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16845         FREE(untag_ptr(ret));
16846         if (get_jenv_res == JNI_EDETACHED) {
16847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16848         }
16849         return ret_conv;
16850 }
16851 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
16852         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16853         JNIEnv *env;
16854         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16855         if (get_jenv_res == JNI_EDETACHED) {
16856                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16857         } else {
16858                 DO_ASSERT(get_jenv_res == JNI_OK);
16859         }
16860         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16861         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16862         LDKChannelReestablish msg_var = *msg;
16863         int64_t msg_ref = 0;
16864         msg_var = ChannelReestablish_clone(&msg_var);
16865         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16866         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16867         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16868         CHECK(obj != NULL);
16869         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
16870         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16871                 (*env)->ExceptionDescribe(env);
16872                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
16873         }
16874         if (get_jenv_res == JNI_EDETACHED) {
16875                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16876         }
16877 }
16878 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
16879         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16880         JNIEnv *env;
16881         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16882         if (get_jenv_res == JNI_EDETACHED) {
16883                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16884         } else {
16885                 DO_ASSERT(get_jenv_res == JNI_OK);
16886         }
16887         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16888         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16889         LDKChannelUpdate msg_var = *msg;
16890         int64_t msg_ref = 0;
16891         msg_var = ChannelUpdate_clone(&msg_var);
16892         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16893         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16894         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16895         CHECK(obj != NULL);
16896         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
16897         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16898                 (*env)->ExceptionDescribe(env);
16899                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
16900         }
16901         if (get_jenv_res == JNI_EDETACHED) {
16902                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16903         }
16904 }
16905 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
16906         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16907         JNIEnv *env;
16908         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16909         if (get_jenv_res == JNI_EDETACHED) {
16910                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16911         } else {
16912                 DO_ASSERT(get_jenv_res == JNI_OK);
16913         }
16914         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16915         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16916         LDKErrorMessage msg_var = *msg;
16917         int64_t msg_ref = 0;
16918         msg_var = ErrorMessage_clone(&msg_var);
16919         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16920         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16921         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16922         CHECK(obj != NULL);
16923         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
16924         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16925                 (*env)->ExceptionDescribe(env);
16926                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
16927         }
16928         if (get_jenv_res == JNI_EDETACHED) {
16929                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16930         }
16931 }
16932 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
16933         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16934         JNIEnv *env;
16935         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16936         if (get_jenv_res == JNI_EDETACHED) {
16937                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16938         } else {
16939                 DO_ASSERT(get_jenv_res == JNI_OK);
16940         }
16941         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16942         CHECK(obj != NULL);
16943         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
16944         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16945                 (*env)->ExceptionDescribe(env);
16946                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
16947         }
16948         LDKNodeFeatures ret_conv;
16949         ret_conv.inner = untag_ptr(ret);
16950         ret_conv.is_owned = ptr_is_owned(ret);
16951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16952         if (get_jenv_res == JNI_EDETACHED) {
16953                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16954         }
16955         return ret_conv;
16956 }
16957 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16958         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16959         JNIEnv *env;
16960         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16961         if (get_jenv_res == JNI_EDETACHED) {
16962                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16963         } else {
16964                 DO_ASSERT(get_jenv_res == JNI_OK);
16965         }
16966         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16967         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16968         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16969         CHECK(obj != NULL);
16970         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
16971         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16972                 (*env)->ExceptionDescribe(env);
16973                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
16974         }
16975         LDKInitFeatures ret_conv;
16976         ret_conv.inner = untag_ptr(ret);
16977         ret_conv.is_owned = ptr_is_owned(ret);
16978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16979         if (get_jenv_res == JNI_EDETACHED) {
16980                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16981         }
16982         return ret_conv;
16983 }
16984 LDKCOption_CVec_ThirtyTwoBytesZZ get_genesis_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
16985         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16986         JNIEnv *env;
16987         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16988         if (get_jenv_res == JNI_EDETACHED) {
16989                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16990         } else {
16991                 DO_ASSERT(get_jenv_res == JNI_OK);
16992         }
16993         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16994         CHECK(obj != NULL);
16995         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_genesis_hashes_meth);
16996         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16997                 (*env)->ExceptionDescribe(env);
16998                 (*env)->FatalError(env, "A call to get_genesis_hashes in LDKChannelMessageHandler from rust threw an exception.");
16999         }
17000         void* ret_ptr = untag_ptr(ret);
17001         CHECK_ACCESS(ret_ptr);
17002         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
17003         FREE(untag_ptr(ret));
17004         if (get_jenv_res == JNI_EDETACHED) {
17005                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17006         }
17007         return ret_conv;
17008 }
17009 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
17010         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
17011         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17012         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
17013 }
17014 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17015         jclass c = (*env)->GetObjectClass(env, o);
17016         CHECK(c != NULL);
17017         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
17018         atomic_init(&calls->refcnt, 1);
17019         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17020         calls->o = (*env)->NewWeakGlobalRef(env, o);
17021         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
17022         CHECK(calls->handle_open_channel_meth != NULL);
17023         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
17024         CHECK(calls->handle_open_channel_v2_meth != NULL);
17025         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
17026         CHECK(calls->handle_accept_channel_meth != NULL);
17027         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
17028         CHECK(calls->handle_accept_channel_v2_meth != NULL);
17029         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
17030         CHECK(calls->handle_funding_created_meth != NULL);
17031         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
17032         CHECK(calls->handle_funding_signed_meth != NULL);
17033         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
17034         CHECK(calls->handle_channel_ready_meth != NULL);
17035         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
17036         CHECK(calls->handle_shutdown_meth != NULL);
17037         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
17038         CHECK(calls->handle_closing_signed_meth != NULL);
17039         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
17040         CHECK(calls->handle_tx_add_input_meth != NULL);
17041         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
17042         CHECK(calls->handle_tx_add_output_meth != NULL);
17043         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
17044         CHECK(calls->handle_tx_remove_input_meth != NULL);
17045         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
17046         CHECK(calls->handle_tx_remove_output_meth != NULL);
17047         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
17048         CHECK(calls->handle_tx_complete_meth != NULL);
17049         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
17050         CHECK(calls->handle_tx_signatures_meth != NULL);
17051         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
17052         CHECK(calls->handle_tx_init_rbf_meth != NULL);
17053         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
17054         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
17055         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
17056         CHECK(calls->handle_tx_abort_meth != NULL);
17057         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
17058         CHECK(calls->handle_update_add_htlc_meth != NULL);
17059         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
17060         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
17061         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
17062         CHECK(calls->handle_update_fail_htlc_meth != NULL);
17063         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
17064         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
17065         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
17066         CHECK(calls->handle_commitment_signed_meth != NULL);
17067         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
17068         CHECK(calls->handle_revoke_and_ack_meth != NULL);
17069         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
17070         CHECK(calls->handle_update_fee_meth != NULL);
17071         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
17072         CHECK(calls->handle_announcement_signatures_meth != NULL);
17073         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
17074         CHECK(calls->peer_disconnected_meth != NULL);
17075         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
17076         CHECK(calls->peer_connected_meth != NULL);
17077         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
17078         CHECK(calls->handle_channel_reestablish_meth != NULL);
17079         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
17080         CHECK(calls->handle_channel_update_meth != NULL);
17081         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
17082         CHECK(calls->handle_error_meth != NULL);
17083         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17084         CHECK(calls->provided_node_features_meth != NULL);
17085         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17086         CHECK(calls->provided_init_features_meth != NULL);
17087         calls->get_genesis_hashes_meth = (*env)->GetMethodID(env, c, "get_genesis_hashes", "()J");
17088         CHECK(calls->get_genesis_hashes_meth != NULL);
17089
17090         LDKChannelMessageHandler ret = {
17091                 .this_arg = (void*) calls,
17092                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
17093                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
17094                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
17095                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
17096                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
17097                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
17098                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
17099                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
17100                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
17101                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
17102                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
17103                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
17104                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
17105                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
17106                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
17107                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
17108                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
17109                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
17110                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
17111                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
17112                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
17113                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
17114                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
17115                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
17116                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
17117                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
17118                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
17119                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
17120                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
17121                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
17122                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
17123                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
17124                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
17125                 .get_genesis_hashes = get_genesis_hashes_LDKChannelMessageHandler_jcall,
17126                 .free = LDKChannelMessageHandler_JCalls_free,
17127                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
17128         };
17129         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
17130         return ret;
17131 }
17132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17133         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17134         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
17135         return tag_ptr(res_ptr, true);
17136 }
17137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
17138         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
17139         return tag_ptr(&inp->MessageSendEventsProvider, false);
17140 }
17141 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 msg) {
17142         void* this_arg_ptr = untag_ptr(this_arg);
17143         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17144         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17145         LDKPublicKey their_node_id_ref;
17146         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17147         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17148         LDKOpenChannel msg_conv;
17149         msg_conv.inner = untag_ptr(msg);
17150         msg_conv.is_owned = ptr_is_owned(msg);
17151         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17152         msg_conv.is_owned = false;
17153         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17154 }
17155
17156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel_1v2(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17157         void* this_arg_ptr = untag_ptr(this_arg);
17158         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17159         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17160         LDKPublicKey their_node_id_ref;
17161         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17162         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17163         LDKOpenChannelV2 msg_conv;
17164         msg_conv.inner = untag_ptr(msg);
17165         msg_conv.is_owned = ptr_is_owned(msg);
17166         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17167         msg_conv.is_owned = false;
17168         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17169 }
17170
17171 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 msg) {
17172         void* this_arg_ptr = untag_ptr(this_arg);
17173         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17174         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17175         LDKPublicKey their_node_id_ref;
17176         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17177         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17178         LDKAcceptChannel msg_conv;
17179         msg_conv.inner = untag_ptr(msg);
17180         msg_conv.is_owned = ptr_is_owned(msg);
17181         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17182         msg_conv.is_owned = false;
17183         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17184 }
17185
17186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel_1v2(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17187         void* this_arg_ptr = untag_ptr(this_arg);
17188         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17189         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17190         LDKPublicKey their_node_id_ref;
17191         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17192         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17193         LDKAcceptChannelV2 msg_conv;
17194         msg_conv.inner = untag_ptr(msg);
17195         msg_conv.is_owned = ptr_is_owned(msg);
17196         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17197         msg_conv.is_owned = false;
17198         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17199 }
17200
17201 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) {
17202         void* this_arg_ptr = untag_ptr(this_arg);
17203         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17204         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17205         LDKPublicKey their_node_id_ref;
17206         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17207         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17208         LDKFundingCreated msg_conv;
17209         msg_conv.inner = untag_ptr(msg);
17210         msg_conv.is_owned = ptr_is_owned(msg);
17211         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17212         msg_conv.is_owned = false;
17213         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17214 }
17215
17216 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) {
17217         void* this_arg_ptr = untag_ptr(this_arg);
17218         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17219         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17220         LDKPublicKey their_node_id_ref;
17221         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17222         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17223         LDKFundingSigned msg_conv;
17224         msg_conv.inner = untag_ptr(msg);
17225         msg_conv.is_owned = ptr_is_owned(msg);
17226         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17227         msg_conv.is_owned = false;
17228         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17229 }
17230
17231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17232         void* this_arg_ptr = untag_ptr(this_arg);
17233         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17234         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17235         LDKPublicKey their_node_id_ref;
17236         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17237         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17238         LDKChannelReady msg_conv;
17239         msg_conv.inner = untag_ptr(msg);
17240         msg_conv.is_owned = ptr_is_owned(msg);
17241         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17242         msg_conv.is_owned = false;
17243         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17244 }
17245
17246 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) {
17247         void* this_arg_ptr = untag_ptr(this_arg);
17248         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17249         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17250         LDKPublicKey their_node_id_ref;
17251         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17252         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17253         LDKShutdown msg_conv;
17254         msg_conv.inner = untag_ptr(msg);
17255         msg_conv.is_owned = ptr_is_owned(msg);
17256         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17257         msg_conv.is_owned = false;
17258         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17259 }
17260
17261 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) {
17262         void* this_arg_ptr = untag_ptr(this_arg);
17263         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17264         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17265         LDKPublicKey their_node_id_ref;
17266         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17267         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17268         LDKClosingSigned msg_conv;
17269         msg_conv.inner = untag_ptr(msg);
17270         msg_conv.is_owned = ptr_is_owned(msg);
17271         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17272         msg_conv.is_owned = false;
17273         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17274 }
17275
17276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1add_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17277         void* this_arg_ptr = untag_ptr(this_arg);
17278         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17279         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17280         LDKPublicKey their_node_id_ref;
17281         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17282         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17283         LDKTxAddInput msg_conv;
17284         msg_conv.inner = untag_ptr(msg);
17285         msg_conv.is_owned = ptr_is_owned(msg);
17286         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17287         msg_conv.is_owned = false;
17288         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17289 }
17290
17291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1add_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17292         void* this_arg_ptr = untag_ptr(this_arg);
17293         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17294         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17295         LDKPublicKey their_node_id_ref;
17296         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17297         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17298         LDKTxAddOutput msg_conv;
17299         msg_conv.inner = untag_ptr(msg);
17300         msg_conv.is_owned = ptr_is_owned(msg);
17301         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17302         msg_conv.is_owned = false;
17303         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17304 }
17305
17306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1remove_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17307         void* this_arg_ptr = untag_ptr(this_arg);
17308         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17309         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17310         LDKPublicKey their_node_id_ref;
17311         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17312         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17313         LDKTxRemoveInput msg_conv;
17314         msg_conv.inner = untag_ptr(msg);
17315         msg_conv.is_owned = ptr_is_owned(msg);
17316         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17317         msg_conv.is_owned = false;
17318         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17319 }
17320
17321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1remove_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17322         void* this_arg_ptr = untag_ptr(this_arg);
17323         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17324         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17325         LDKPublicKey their_node_id_ref;
17326         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17327         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17328         LDKTxRemoveOutput msg_conv;
17329         msg_conv.inner = untag_ptr(msg);
17330         msg_conv.is_owned = ptr_is_owned(msg);
17331         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17332         msg_conv.is_owned = false;
17333         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17334 }
17335
17336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1complete(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17337         void* this_arg_ptr = untag_ptr(this_arg);
17338         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17339         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17340         LDKPublicKey their_node_id_ref;
17341         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17342         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17343         LDKTxComplete msg_conv;
17344         msg_conv.inner = untag_ptr(msg);
17345         msg_conv.is_owned = ptr_is_owned(msg);
17346         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17347         msg_conv.is_owned = false;
17348         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17349 }
17350
17351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1signatures(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17352         void* this_arg_ptr = untag_ptr(this_arg);
17353         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17354         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17355         LDKPublicKey their_node_id_ref;
17356         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17357         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17358         LDKTxSignatures msg_conv;
17359         msg_conv.inner = untag_ptr(msg);
17360         msg_conv.is_owned = ptr_is_owned(msg);
17361         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17362         msg_conv.is_owned = false;
17363         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17364 }
17365
17366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1init_1rbf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17367         void* this_arg_ptr = untag_ptr(this_arg);
17368         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17369         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17370         LDKPublicKey their_node_id_ref;
17371         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17372         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17373         LDKTxInitRbf msg_conv;
17374         msg_conv.inner = untag_ptr(msg);
17375         msg_conv.is_owned = ptr_is_owned(msg);
17376         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17377         msg_conv.is_owned = false;
17378         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17379 }
17380
17381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1ack_1rbf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17382         void* this_arg_ptr = untag_ptr(this_arg);
17383         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17384         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17385         LDKPublicKey their_node_id_ref;
17386         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17387         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17388         LDKTxAckRbf msg_conv;
17389         msg_conv.inner = untag_ptr(msg);
17390         msg_conv.is_owned = ptr_is_owned(msg);
17391         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17392         msg_conv.is_owned = false;
17393         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17394 }
17395
17396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1abort(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17397         void* this_arg_ptr = untag_ptr(this_arg);
17398         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17399         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17400         LDKPublicKey their_node_id_ref;
17401         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17402         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17403         LDKTxAbort msg_conv;
17404         msg_conv.inner = untag_ptr(msg);
17405         msg_conv.is_owned = ptr_is_owned(msg);
17406         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17407         msg_conv.is_owned = false;
17408         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17409 }
17410
17411 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) {
17412         void* this_arg_ptr = untag_ptr(this_arg);
17413         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17414         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17415         LDKPublicKey their_node_id_ref;
17416         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17417         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17418         LDKUpdateAddHTLC msg_conv;
17419         msg_conv.inner = untag_ptr(msg);
17420         msg_conv.is_owned = ptr_is_owned(msg);
17421         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17422         msg_conv.is_owned = false;
17423         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17424 }
17425
17426 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) {
17427         void* this_arg_ptr = untag_ptr(this_arg);
17428         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17429         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17430         LDKPublicKey their_node_id_ref;
17431         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17432         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17433         LDKUpdateFulfillHTLC msg_conv;
17434         msg_conv.inner = untag_ptr(msg);
17435         msg_conv.is_owned = ptr_is_owned(msg);
17436         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17437         msg_conv.is_owned = false;
17438         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17439 }
17440
17441 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) {
17442         void* this_arg_ptr = untag_ptr(this_arg);
17443         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17444         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17445         LDKPublicKey their_node_id_ref;
17446         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17447         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17448         LDKUpdateFailHTLC msg_conv;
17449         msg_conv.inner = untag_ptr(msg);
17450         msg_conv.is_owned = ptr_is_owned(msg);
17451         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17452         msg_conv.is_owned = false;
17453         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17454 }
17455
17456 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) {
17457         void* this_arg_ptr = untag_ptr(this_arg);
17458         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17459         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17460         LDKPublicKey their_node_id_ref;
17461         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17462         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17463         LDKUpdateFailMalformedHTLC msg_conv;
17464         msg_conv.inner = untag_ptr(msg);
17465         msg_conv.is_owned = ptr_is_owned(msg);
17466         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17467         msg_conv.is_owned = false;
17468         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17469 }
17470
17471 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) {
17472         void* this_arg_ptr = untag_ptr(this_arg);
17473         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17474         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17475         LDKPublicKey their_node_id_ref;
17476         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17477         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17478         LDKCommitmentSigned msg_conv;
17479         msg_conv.inner = untag_ptr(msg);
17480         msg_conv.is_owned = ptr_is_owned(msg);
17481         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17482         msg_conv.is_owned = false;
17483         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17484 }
17485
17486 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) {
17487         void* this_arg_ptr = untag_ptr(this_arg);
17488         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17489         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17490         LDKPublicKey their_node_id_ref;
17491         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17492         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17493         LDKRevokeAndACK msg_conv;
17494         msg_conv.inner = untag_ptr(msg);
17495         msg_conv.is_owned = ptr_is_owned(msg);
17496         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17497         msg_conv.is_owned = false;
17498         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17499 }
17500
17501 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) {
17502         void* this_arg_ptr = untag_ptr(this_arg);
17503         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17504         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17505         LDKPublicKey their_node_id_ref;
17506         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17507         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17508         LDKUpdateFee msg_conv;
17509         msg_conv.inner = untag_ptr(msg);
17510         msg_conv.is_owned = ptr_is_owned(msg);
17511         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17512         msg_conv.is_owned = false;
17513         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17514 }
17515
17516 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) {
17517         void* this_arg_ptr = untag_ptr(this_arg);
17518         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17519         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17520         LDKPublicKey their_node_id_ref;
17521         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17522         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17523         LDKAnnouncementSignatures msg_conv;
17524         msg_conv.inner = untag_ptr(msg);
17525         msg_conv.is_owned = ptr_is_owned(msg);
17526         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17527         msg_conv.is_owned = false;
17528         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17529 }
17530
17531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
17532         void* this_arg_ptr = untag_ptr(this_arg);
17533         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17534         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17535         LDKPublicKey their_node_id_ref;
17536         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17537         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17538         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
17539 }
17540
17541 JNIEXPORT int64_t 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, jboolean inbound) {
17542         void* this_arg_ptr = untag_ptr(this_arg);
17543         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17544         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17545         LDKPublicKey their_node_id_ref;
17546         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17547         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17548         LDKInit msg_conv;
17549         msg_conv.inner = untag_ptr(msg);
17550         msg_conv.is_owned = ptr_is_owned(msg);
17551         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17552         msg_conv.is_owned = false;
17553         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17554         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
17555         return tag_ptr(ret_conv, true);
17556 }
17557
17558 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) {
17559         void* this_arg_ptr = untag_ptr(this_arg);
17560         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17561         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17562         LDKPublicKey their_node_id_ref;
17563         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17564         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17565         LDKChannelReestablish msg_conv;
17566         msg_conv.inner = untag_ptr(msg);
17567         msg_conv.is_owned = ptr_is_owned(msg);
17568         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17569         msg_conv.is_owned = false;
17570         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17571 }
17572
17573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
17574         void* this_arg_ptr = untag_ptr(this_arg);
17575         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17576         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17577         LDKPublicKey their_node_id_ref;
17578         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17579         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17580         LDKChannelUpdate msg_conv;
17581         msg_conv.inner = untag_ptr(msg);
17582         msg_conv.is_owned = ptr_is_owned(msg);
17583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17584         msg_conv.is_owned = false;
17585         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17586 }
17587
17588 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) {
17589         void* this_arg_ptr = untag_ptr(this_arg);
17590         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17591         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17592         LDKPublicKey their_node_id_ref;
17593         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17594         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17595         LDKErrorMessage msg_conv;
17596         msg_conv.inner = untag_ptr(msg);
17597         msg_conv.is_owned = ptr_is_owned(msg);
17598         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17599         msg_conv.is_owned = false;
17600         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17601 }
17602
17603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17604         void* this_arg_ptr = untag_ptr(this_arg);
17605         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17606         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17607         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17608         int64_t ret_ref = 0;
17609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17611         return ret_ref;
17612 }
17613
17614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
17615         void* this_arg_ptr = untag_ptr(this_arg);
17616         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17617         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17618         LDKPublicKey their_node_id_ref;
17619         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17620         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17621         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17622         int64_t ret_ref = 0;
17623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17625         return ret_ref;
17626 }
17627
17628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1genesis_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
17629         void* this_arg_ptr = untag_ptr(this_arg);
17630         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17631         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17632         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17633         *ret_copy = (this_arg_conv->get_genesis_hashes)(this_arg_conv->this_arg);
17634         int64_t ret_ref = tag_ptr(ret_copy, true);
17635         return ret_ref;
17636 }
17637
17638 typedef struct LDKRoutingMessageHandler_JCalls {
17639         atomic_size_t refcnt;
17640         JavaVM *vm;
17641         jweak o;
17642         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
17643         jmethodID handle_node_announcement_meth;
17644         jmethodID handle_channel_announcement_meth;
17645         jmethodID handle_channel_update_meth;
17646         jmethodID get_next_channel_announcement_meth;
17647         jmethodID get_next_node_announcement_meth;
17648         jmethodID peer_connected_meth;
17649         jmethodID handle_reply_channel_range_meth;
17650         jmethodID handle_reply_short_channel_ids_end_meth;
17651         jmethodID handle_query_channel_range_meth;
17652         jmethodID handle_query_short_channel_ids_meth;
17653         jmethodID processing_queue_high_meth;
17654         jmethodID provided_node_features_meth;
17655         jmethodID provided_init_features_meth;
17656 } LDKRoutingMessageHandler_JCalls;
17657 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
17658         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17659         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17660                 JNIEnv *env;
17661                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17662                 if (get_jenv_res == JNI_EDETACHED) {
17663                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17664                 } else {
17665                         DO_ASSERT(get_jenv_res == JNI_OK);
17666                 }
17667                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17668                 if (get_jenv_res == JNI_EDETACHED) {
17669                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17670                 }
17671                 FREE(j_calls);
17672         }
17673 }
17674 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
17675         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17676         JNIEnv *env;
17677         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17678         if (get_jenv_res == JNI_EDETACHED) {
17679                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17680         } else {
17681                 DO_ASSERT(get_jenv_res == JNI_OK);
17682         }
17683         LDKNodeAnnouncement msg_var = *msg;
17684         int64_t msg_ref = 0;
17685         msg_var = NodeAnnouncement_clone(&msg_var);
17686         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17687         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17688         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17689         CHECK(obj != NULL);
17690         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
17691         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17692                 (*env)->ExceptionDescribe(env);
17693                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
17694         }
17695         void* ret_ptr = untag_ptr(ret);
17696         CHECK_ACCESS(ret_ptr);
17697         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
17698         FREE(untag_ptr(ret));
17699         if (get_jenv_res == JNI_EDETACHED) {
17700                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17701         }
17702         return ret_conv;
17703 }
17704 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
17705         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17706         JNIEnv *env;
17707         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17708         if (get_jenv_res == JNI_EDETACHED) {
17709                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17710         } else {
17711                 DO_ASSERT(get_jenv_res == JNI_OK);
17712         }
17713         LDKChannelAnnouncement msg_var = *msg;
17714         int64_t msg_ref = 0;
17715         msg_var = ChannelAnnouncement_clone(&msg_var);
17716         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17717         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17718         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17719         CHECK(obj != NULL);
17720         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
17721         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17722                 (*env)->ExceptionDescribe(env);
17723                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
17724         }
17725         void* ret_ptr = untag_ptr(ret);
17726         CHECK_ACCESS(ret_ptr);
17727         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
17728         FREE(untag_ptr(ret));
17729         if (get_jenv_res == JNI_EDETACHED) {
17730                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17731         }
17732         return ret_conv;
17733 }
17734 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
17735         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17736         JNIEnv *env;
17737         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17738         if (get_jenv_res == JNI_EDETACHED) {
17739                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17740         } else {
17741                 DO_ASSERT(get_jenv_res == JNI_OK);
17742         }
17743         LDKChannelUpdate msg_var = *msg;
17744         int64_t msg_ref = 0;
17745         msg_var = ChannelUpdate_clone(&msg_var);
17746         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17747         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17748         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17749         CHECK(obj != NULL);
17750         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
17751         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17752                 (*env)->ExceptionDescribe(env);
17753                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
17754         }
17755         void* ret_ptr = untag_ptr(ret);
17756         CHECK_ACCESS(ret_ptr);
17757         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
17758         FREE(untag_ptr(ret));
17759         if (get_jenv_res == JNI_EDETACHED) {
17760                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17761         }
17762         return ret_conv;
17763 }
17764 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
17765         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17766         JNIEnv *env;
17767         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17768         if (get_jenv_res == JNI_EDETACHED) {
17769                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17770         } else {
17771                 DO_ASSERT(get_jenv_res == JNI_OK);
17772         }
17773         int64_t starting_point_conv = starting_point;
17774         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17775         CHECK(obj != NULL);
17776         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
17777         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17778                 (*env)->ExceptionDescribe(env);
17779                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
17780         }
17781         void* ret_ptr = untag_ptr(ret);
17782         CHECK_ACCESS(ret_ptr);
17783         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
17784         FREE(untag_ptr(ret));
17785         if (get_jenv_res == JNI_EDETACHED) {
17786                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17787         }
17788         return ret_conv;
17789 }
17790 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
17791         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17792         JNIEnv *env;
17793         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17794         if (get_jenv_res == JNI_EDETACHED) {
17795                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17796         } else {
17797                 DO_ASSERT(get_jenv_res == JNI_OK);
17798         }
17799         LDKNodeId starting_point_var = starting_point;
17800         int64_t starting_point_ref = 0;
17801         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
17802         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
17803         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17804         CHECK(obj != NULL);
17805         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
17806         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17807                 (*env)->ExceptionDescribe(env);
17808                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
17809         }
17810         LDKNodeAnnouncement ret_conv;
17811         ret_conv.inner = untag_ptr(ret);
17812         ret_conv.is_owned = ptr_is_owned(ret);
17813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17814         if (get_jenv_res == JNI_EDETACHED) {
17815                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17816         }
17817         return ret_conv;
17818 }
17819 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
17820         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17821         JNIEnv *env;
17822         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17823         if (get_jenv_res == JNI_EDETACHED) {
17824                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17825         } else {
17826                 DO_ASSERT(get_jenv_res == JNI_OK);
17827         }
17828         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17829         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17830         LDKInit init_var = *init;
17831         int64_t init_ref = 0;
17832         init_var = Init_clone(&init_var);
17833         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
17834         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
17835         jboolean inbound_conv = inbound;
17836         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17837         CHECK(obj != NULL);
17838         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
17839         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17840                 (*env)->ExceptionDescribe(env);
17841                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
17842         }
17843         void* ret_ptr = untag_ptr(ret);
17844         CHECK_ACCESS(ret_ptr);
17845         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
17846         FREE(untag_ptr(ret));
17847         if (get_jenv_res == JNI_EDETACHED) {
17848                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17849         }
17850         return ret_conv;
17851 }
17852 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
17853         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17854         JNIEnv *env;
17855         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17856         if (get_jenv_res == JNI_EDETACHED) {
17857                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17858         } else {
17859                 DO_ASSERT(get_jenv_res == JNI_OK);
17860         }
17861         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17862         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17863         LDKReplyChannelRange msg_var = msg;
17864         int64_t msg_ref = 0;
17865         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17866         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17867         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17868         CHECK(obj != NULL);
17869         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
17870         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17871                 (*env)->ExceptionDescribe(env);
17872                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
17873         }
17874         void* ret_ptr = untag_ptr(ret);
17875         CHECK_ACCESS(ret_ptr);
17876         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17877         FREE(untag_ptr(ret));
17878         if (get_jenv_res == JNI_EDETACHED) {
17879                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17880         }
17881         return ret_conv;
17882 }
17883 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
17884         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17885         JNIEnv *env;
17886         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17887         if (get_jenv_res == JNI_EDETACHED) {
17888                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17889         } else {
17890                 DO_ASSERT(get_jenv_res == JNI_OK);
17891         }
17892         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17893         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17894         LDKReplyShortChannelIdsEnd msg_var = msg;
17895         int64_t msg_ref = 0;
17896         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17897         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17898         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17899         CHECK(obj != NULL);
17900         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
17901         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17902                 (*env)->ExceptionDescribe(env);
17903                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
17904         }
17905         void* ret_ptr = untag_ptr(ret);
17906         CHECK_ACCESS(ret_ptr);
17907         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17908         FREE(untag_ptr(ret));
17909         if (get_jenv_res == JNI_EDETACHED) {
17910                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17911         }
17912         return ret_conv;
17913 }
17914 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
17915         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17916         JNIEnv *env;
17917         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17918         if (get_jenv_res == JNI_EDETACHED) {
17919                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17920         } else {
17921                 DO_ASSERT(get_jenv_res == JNI_OK);
17922         }
17923         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17924         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17925         LDKQueryChannelRange msg_var = msg;
17926         int64_t msg_ref = 0;
17927         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17928         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17929         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17930         CHECK(obj != NULL);
17931         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
17932         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17933                 (*env)->ExceptionDescribe(env);
17934                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
17935         }
17936         void* ret_ptr = untag_ptr(ret);
17937         CHECK_ACCESS(ret_ptr);
17938         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17939         FREE(untag_ptr(ret));
17940         if (get_jenv_res == JNI_EDETACHED) {
17941                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17942         }
17943         return ret_conv;
17944 }
17945 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
17946         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17947         JNIEnv *env;
17948         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17949         if (get_jenv_res == JNI_EDETACHED) {
17950                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17951         } else {
17952                 DO_ASSERT(get_jenv_res == JNI_OK);
17953         }
17954         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17955         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17956         LDKQueryShortChannelIds msg_var = msg;
17957         int64_t msg_ref = 0;
17958         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17959         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17960         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17961         CHECK(obj != NULL);
17962         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
17963         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17964                 (*env)->ExceptionDescribe(env);
17965                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
17966         }
17967         void* ret_ptr = untag_ptr(ret);
17968         CHECK_ACCESS(ret_ptr);
17969         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17970         FREE(untag_ptr(ret));
17971         if (get_jenv_res == JNI_EDETACHED) {
17972                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17973         }
17974         return ret_conv;
17975 }
17976 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
17977         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17978         JNIEnv *env;
17979         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17980         if (get_jenv_res == JNI_EDETACHED) {
17981                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17982         } else {
17983                 DO_ASSERT(get_jenv_res == JNI_OK);
17984         }
17985         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17986         CHECK(obj != NULL);
17987         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
17988         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17989                 (*env)->ExceptionDescribe(env);
17990                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
17991         }
17992         if (get_jenv_res == JNI_EDETACHED) {
17993                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17994         }
17995         return ret;
17996 }
17997 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
17998         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17999         JNIEnv *env;
18000         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18001         if (get_jenv_res == JNI_EDETACHED) {
18002                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18003         } else {
18004                 DO_ASSERT(get_jenv_res == JNI_OK);
18005         }
18006         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18007         CHECK(obj != NULL);
18008         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18009         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18010                 (*env)->ExceptionDescribe(env);
18011                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
18012         }
18013         LDKNodeFeatures ret_conv;
18014         ret_conv.inner = untag_ptr(ret);
18015         ret_conv.is_owned = ptr_is_owned(ret);
18016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18017         if (get_jenv_res == JNI_EDETACHED) {
18018                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18019         }
18020         return ret_conv;
18021 }
18022 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18023         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18024         JNIEnv *env;
18025         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18026         if (get_jenv_res == JNI_EDETACHED) {
18027                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18028         } else {
18029                 DO_ASSERT(get_jenv_res == JNI_OK);
18030         }
18031         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18032         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18033         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18034         CHECK(obj != NULL);
18035         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18036         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18037                 (*env)->ExceptionDescribe(env);
18038                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
18039         }
18040         LDKInitFeatures ret_conv;
18041         ret_conv.inner = untag_ptr(ret);
18042         ret_conv.is_owned = ptr_is_owned(ret);
18043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18044         if (get_jenv_res == JNI_EDETACHED) {
18045                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18046         }
18047         return ret_conv;
18048 }
18049 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
18050         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
18051         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18052         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
18053 }
18054 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18055         jclass c = (*env)->GetObjectClass(env, o);
18056         CHECK(c != NULL);
18057         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
18058         atomic_init(&calls->refcnt, 1);
18059         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18060         calls->o = (*env)->NewWeakGlobalRef(env, o);
18061         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
18062         CHECK(calls->handle_node_announcement_meth != NULL);
18063         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
18064         CHECK(calls->handle_channel_announcement_meth != NULL);
18065         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
18066         CHECK(calls->handle_channel_update_meth != NULL);
18067         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
18068         CHECK(calls->get_next_channel_announcement_meth != NULL);
18069         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
18070         CHECK(calls->get_next_node_announcement_meth != NULL);
18071         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18072         CHECK(calls->peer_connected_meth != NULL);
18073         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
18074         CHECK(calls->handle_reply_channel_range_meth != NULL);
18075         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
18076         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
18077         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
18078         CHECK(calls->handle_query_channel_range_meth != NULL);
18079         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
18080         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
18081         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
18082         CHECK(calls->processing_queue_high_meth != NULL);
18083         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18084         CHECK(calls->provided_node_features_meth != NULL);
18085         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18086         CHECK(calls->provided_init_features_meth != NULL);
18087
18088         LDKRoutingMessageHandler ret = {
18089                 .this_arg = (void*) calls,
18090                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
18091                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
18092                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
18093                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
18094                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
18095                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
18096                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
18097                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
18098                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
18099                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
18100                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
18101                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
18102                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
18103                 .free = LDKRoutingMessageHandler_JCalls_free,
18104                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
18105         };
18106         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
18107         return ret;
18108 }
18109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18110         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
18111         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
18112         return tag_ptr(res_ptr, true);
18113 }
18114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
18115         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
18116         return tag_ptr(&inp->MessageSendEventsProvider, false);
18117 }
18118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18119         void* this_arg_ptr = untag_ptr(this_arg);
18120         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18121         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18122         LDKNodeAnnouncement msg_conv;
18123         msg_conv.inner = untag_ptr(msg);
18124         msg_conv.is_owned = ptr_is_owned(msg);
18125         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18126         msg_conv.is_owned = false;
18127         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18128         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
18129         return tag_ptr(ret_conv, true);
18130 }
18131
18132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18133         void* this_arg_ptr = untag_ptr(this_arg);
18134         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18135         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18136         LDKChannelAnnouncement msg_conv;
18137         msg_conv.inner = untag_ptr(msg);
18138         msg_conv.is_owned = ptr_is_owned(msg);
18139         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18140         msg_conv.is_owned = false;
18141         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18142         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
18143         return tag_ptr(ret_conv, true);
18144 }
18145
18146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18147         void* this_arg_ptr = untag_ptr(this_arg);
18148         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18149         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18150         LDKChannelUpdate msg_conv;
18151         msg_conv.inner = untag_ptr(msg);
18152         msg_conv.is_owned = ptr_is_owned(msg);
18153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18154         msg_conv.is_owned = false;
18155         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18156         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
18157         return tag_ptr(ret_conv, true);
18158 }
18159
18160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point) {
18161         void* this_arg_ptr = untag_ptr(this_arg);
18162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18163         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18164         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
18165         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
18166         int64_t ret_ref = tag_ptr(ret_copy, true);
18167         return ret_ref;
18168 }
18169
18170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point) {
18171         void* this_arg_ptr = untag_ptr(this_arg);
18172         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18173         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18174         LDKNodeId starting_point_conv;
18175         starting_point_conv.inner = untag_ptr(starting_point);
18176         starting_point_conv.is_owned = ptr_is_owned(starting_point);
18177         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
18178         starting_point_conv = NodeId_clone(&starting_point_conv);
18179         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
18180         int64_t ret_ref = 0;
18181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18183         return ret_ref;
18184 }
18185
18186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
18187         void* this_arg_ptr = untag_ptr(this_arg);
18188         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18189         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18190         LDKPublicKey their_node_id_ref;
18191         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18192         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18193         LDKInit init_conv;
18194         init_conv.inner = untag_ptr(init);
18195         init_conv.is_owned = ptr_is_owned(init);
18196         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
18197         init_conv.is_owned = false;
18198         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18199         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
18200         return tag_ptr(ret_conv, true);
18201 }
18202
18203 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) {
18204         void* this_arg_ptr = untag_ptr(this_arg);
18205         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18206         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18207         LDKPublicKey their_node_id_ref;
18208         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18209         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18210         LDKReplyChannelRange msg_conv;
18211         msg_conv.inner = untag_ptr(msg);
18212         msg_conv.is_owned = ptr_is_owned(msg);
18213         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18214         msg_conv = ReplyChannelRange_clone(&msg_conv);
18215         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18216         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18217         return tag_ptr(ret_conv, true);
18218 }
18219
18220 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) {
18221         void* this_arg_ptr = untag_ptr(this_arg);
18222         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18223         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18224         LDKPublicKey their_node_id_ref;
18225         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18226         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18227         LDKReplyShortChannelIdsEnd msg_conv;
18228         msg_conv.inner = untag_ptr(msg);
18229         msg_conv.is_owned = ptr_is_owned(msg);
18230         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18231         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
18232         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18233         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18234         return tag_ptr(ret_conv, true);
18235 }
18236
18237 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) {
18238         void* this_arg_ptr = untag_ptr(this_arg);
18239         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18240         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18241         LDKPublicKey their_node_id_ref;
18242         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18243         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18244         LDKQueryChannelRange msg_conv;
18245         msg_conv.inner = untag_ptr(msg);
18246         msg_conv.is_owned = ptr_is_owned(msg);
18247         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18248         msg_conv = QueryChannelRange_clone(&msg_conv);
18249         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18250         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18251         return tag_ptr(ret_conv, true);
18252 }
18253
18254 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) {
18255         void* this_arg_ptr = untag_ptr(this_arg);
18256         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18257         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18258         LDKPublicKey their_node_id_ref;
18259         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18260         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18261         LDKQueryShortChannelIds msg_conv;
18262         msg_conv.inner = untag_ptr(msg);
18263         msg_conv.is_owned = ptr_is_owned(msg);
18264         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18265         msg_conv = QueryShortChannelIds_clone(&msg_conv);
18266         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18267         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18268         return tag_ptr(ret_conv, true);
18269 }
18270
18271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
18272         void* this_arg_ptr = untag_ptr(this_arg);
18273         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18274         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18275         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
18276         return ret_conv;
18277 }
18278
18279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
18280         void* this_arg_ptr = untag_ptr(this_arg);
18281         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18282         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18283         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
18284         int64_t ret_ref = 0;
18285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18287         return ret_ref;
18288 }
18289
18290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
18291         void* this_arg_ptr = untag_ptr(this_arg);
18292         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18293         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18294         LDKPublicKey their_node_id_ref;
18295         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18296         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18297         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
18298         int64_t ret_ref = 0;
18299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18301         return ret_ref;
18302 }
18303
18304 typedef struct LDKOnionMessageProvider_JCalls {
18305         atomic_size_t refcnt;
18306         JavaVM *vm;
18307         jweak o;
18308         jmethodID next_onion_message_for_peer_meth;
18309 } LDKOnionMessageProvider_JCalls;
18310 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
18311         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
18312         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18313                 JNIEnv *env;
18314                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18315                 if (get_jenv_res == JNI_EDETACHED) {
18316                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18317                 } else {
18318                         DO_ASSERT(get_jenv_res == JNI_OK);
18319                 }
18320                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18321                 if (get_jenv_res == JNI_EDETACHED) {
18322                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18323                 }
18324                 FREE(j_calls);
18325         }
18326 }
18327 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
18328         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
18329         JNIEnv *env;
18330         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18331         if (get_jenv_res == JNI_EDETACHED) {
18332                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18333         } else {
18334                 DO_ASSERT(get_jenv_res == JNI_OK);
18335         }
18336         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
18337         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
18338         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18339         CHECK(obj != NULL);
18340         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
18341         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18342                 (*env)->ExceptionDescribe(env);
18343                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageProvider from rust threw an exception.");
18344         }
18345         LDKOnionMessage ret_conv;
18346         ret_conv.inner = untag_ptr(ret);
18347         ret_conv.is_owned = ptr_is_owned(ret);
18348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18349         if (get_jenv_res == JNI_EDETACHED) {
18350                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18351         }
18352         return ret_conv;
18353 }
18354 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
18355         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
18356         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18357 }
18358 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JNIEnv *env, jclass clz, jobject o) {
18359         jclass c = (*env)->GetObjectClass(env, o);
18360         CHECK(c != NULL);
18361         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
18362         atomic_init(&calls->refcnt, 1);
18363         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18364         calls->o = (*env)->NewWeakGlobalRef(env, o);
18365         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
18366         CHECK(calls->next_onion_message_for_peer_meth != NULL);
18367
18368         LDKOnionMessageProvider ret = {
18369                 .this_arg = (void*) calls,
18370                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
18371                 .free = LDKOnionMessageProvider_JCalls_free,
18372         };
18373         return ret;
18374 }
18375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageProvider_1new(JNIEnv *env, jclass clz, jobject o) {
18376         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
18377         *res_ptr = LDKOnionMessageProvider_init(env, clz, o);
18378         return tag_ptr(res_ptr, true);
18379 }
18380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1next_1onion_1message_1for_1peer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id) {
18381         void* this_arg_ptr = untag_ptr(this_arg);
18382         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18383         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
18384         LDKPublicKey peer_node_id_ref;
18385         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
18386         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
18387         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
18388         int64_t ret_ref = 0;
18389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18391         return ret_ref;
18392 }
18393
18394 typedef struct LDKOnionMessageHandler_JCalls {
18395         atomic_size_t refcnt;
18396         JavaVM *vm;
18397         jweak o;
18398         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
18399         jmethodID handle_onion_message_meth;
18400         jmethodID peer_connected_meth;
18401         jmethodID peer_disconnected_meth;
18402         jmethodID provided_node_features_meth;
18403         jmethodID provided_init_features_meth;
18404 } LDKOnionMessageHandler_JCalls;
18405 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
18406         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18407         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18408                 JNIEnv *env;
18409                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18410                 if (get_jenv_res == JNI_EDETACHED) {
18411                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18412                 } else {
18413                         DO_ASSERT(get_jenv_res == JNI_OK);
18414                 }
18415                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18416                 if (get_jenv_res == JNI_EDETACHED) {
18417                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18418                 }
18419                 FREE(j_calls);
18420         }
18421 }
18422 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
18423         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18424         JNIEnv *env;
18425         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18426         if (get_jenv_res == JNI_EDETACHED) {
18427                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18428         } else {
18429                 DO_ASSERT(get_jenv_res == JNI_OK);
18430         }
18431         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
18432         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
18433         LDKOnionMessage msg_var = *msg;
18434         int64_t msg_ref = 0;
18435         msg_var = OnionMessage_clone(&msg_var);
18436         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18437         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18438         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18439         CHECK(obj != NULL);
18440         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
18441         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18442                 (*env)->ExceptionDescribe(env);
18443                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
18444         }
18445         if (get_jenv_res == JNI_EDETACHED) {
18446                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18447         }
18448 }
18449 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
18450         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18451         JNIEnv *env;
18452         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18453         if (get_jenv_res == JNI_EDETACHED) {
18454                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18455         } else {
18456                 DO_ASSERT(get_jenv_res == JNI_OK);
18457         }
18458         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18459         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18460         LDKInit init_var = *init;
18461         int64_t init_ref = 0;
18462         init_var = Init_clone(&init_var);
18463         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
18464         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
18465         jboolean inbound_conv = inbound;
18466         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18467         CHECK(obj != NULL);
18468         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
18469         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18470                 (*env)->ExceptionDescribe(env);
18471                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
18472         }
18473         void* ret_ptr = untag_ptr(ret);
18474         CHECK_ACCESS(ret_ptr);
18475         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
18476         FREE(untag_ptr(ret));
18477         if (get_jenv_res == JNI_EDETACHED) {
18478                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18479         }
18480         return ret_conv;
18481 }
18482 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18483         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18484         JNIEnv *env;
18485         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18486         if (get_jenv_res == JNI_EDETACHED) {
18487                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18488         } else {
18489                 DO_ASSERT(get_jenv_res == JNI_OK);
18490         }
18491         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18492         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18493         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18494         CHECK(obj != NULL);
18495         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
18496         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18497                 (*env)->ExceptionDescribe(env);
18498                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
18499         }
18500         if (get_jenv_res == JNI_EDETACHED) {
18501                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18502         }
18503 }
18504 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
18505         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18506         JNIEnv *env;
18507         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18508         if (get_jenv_res == JNI_EDETACHED) {
18509                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18510         } else {
18511                 DO_ASSERT(get_jenv_res == JNI_OK);
18512         }
18513         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18514         CHECK(obj != NULL);
18515         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18516         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18517                 (*env)->ExceptionDescribe(env);
18518                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
18519         }
18520         LDKNodeFeatures ret_conv;
18521         ret_conv.inner = untag_ptr(ret);
18522         ret_conv.is_owned = ptr_is_owned(ret);
18523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18524         if (get_jenv_res == JNI_EDETACHED) {
18525                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18526         }
18527         return ret_conv;
18528 }
18529 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18530         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18531         JNIEnv *env;
18532         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18533         if (get_jenv_res == JNI_EDETACHED) {
18534                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18535         } else {
18536                 DO_ASSERT(get_jenv_res == JNI_OK);
18537         }
18538         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18539         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18540         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18541         CHECK(obj != NULL);
18542         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18543         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18544                 (*env)->ExceptionDescribe(env);
18545                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
18546         }
18547         LDKInitFeatures ret_conv;
18548         ret_conv.inner = untag_ptr(ret);
18549         ret_conv.is_owned = ptr_is_owned(ret);
18550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18551         if (get_jenv_res == JNI_EDETACHED) {
18552                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18553         }
18554         return ret_conv;
18555 }
18556 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
18557         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
18558         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18559         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
18560 }
18561 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
18562         jclass c = (*env)->GetObjectClass(env, o);
18563         CHECK(c != NULL);
18564         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
18565         atomic_init(&calls->refcnt, 1);
18566         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18567         calls->o = (*env)->NewWeakGlobalRef(env, o);
18568         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
18569         CHECK(calls->handle_onion_message_meth != NULL);
18570         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18571         CHECK(calls->peer_connected_meth != NULL);
18572         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
18573         CHECK(calls->peer_disconnected_meth != NULL);
18574         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18575         CHECK(calls->provided_node_features_meth != NULL);
18576         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18577         CHECK(calls->provided_init_features_meth != NULL);
18578
18579         LDKOnionMessageHandler ret = {
18580                 .this_arg = (void*) calls,
18581                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
18582                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
18583                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
18584                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
18585                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
18586                 .free = LDKOnionMessageHandler_JCalls_free,
18587                 .OnionMessageProvider = LDKOnionMessageProvider_init(env, clz, OnionMessageProvider),
18588         };
18589         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
18590         return ret;
18591 }
18592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
18593         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
18594         *res_ptr = LDKOnionMessageHandler_init(env, clz, o, OnionMessageProvider);
18595         return tag_ptr(res_ptr, true);
18596 }
18597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1get_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t arg) {
18598         LDKOnionMessageHandler *inp = (LDKOnionMessageHandler *)untag_ptr(arg);
18599         return tag_ptr(&inp->OnionMessageProvider, false);
18600 }
18601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id, int64_t msg) {
18602         void* this_arg_ptr = untag_ptr(this_arg);
18603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18604         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18605         LDKPublicKey peer_node_id_ref;
18606         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
18607         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
18608         LDKOnionMessage msg_conv;
18609         msg_conv.inner = untag_ptr(msg);
18610         msg_conv.is_owned = ptr_is_owned(msg);
18611         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18612         msg_conv.is_owned = false;
18613         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
18614 }
18615
18616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
18617         void* this_arg_ptr = untag_ptr(this_arg);
18618         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18619         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18620         LDKPublicKey their_node_id_ref;
18621         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18622         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18623         LDKInit init_conv;
18624         init_conv.inner = untag_ptr(init);
18625         init_conv.is_owned = ptr_is_owned(init);
18626         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
18627         init_conv.is_owned = false;
18628         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18629         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
18630         return tag_ptr(ret_conv, true);
18631 }
18632
18633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
18634         void* this_arg_ptr = untag_ptr(this_arg);
18635         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18636         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18637         LDKPublicKey their_node_id_ref;
18638         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18639         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18640         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
18641 }
18642
18643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
18644         void* this_arg_ptr = untag_ptr(this_arg);
18645         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18646         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18647         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
18648         int64_t ret_ref = 0;
18649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18651         return ret_ref;
18652 }
18653
18654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
18655         void* this_arg_ptr = untag_ptr(this_arg);
18656         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18657         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18658         LDKPublicKey their_node_id_ref;
18659         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18660         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18661         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
18662         int64_t ret_ref = 0;
18663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18665         return ret_ref;
18666 }
18667
18668 typedef struct LDKCustomMessageReader_JCalls {
18669         atomic_size_t refcnt;
18670         JavaVM *vm;
18671         jweak o;
18672         jmethodID read_meth;
18673 } LDKCustomMessageReader_JCalls;
18674 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
18675         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
18676         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18677                 JNIEnv *env;
18678                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18679                 if (get_jenv_res == JNI_EDETACHED) {
18680                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18681                 } else {
18682                         DO_ASSERT(get_jenv_res == JNI_OK);
18683                 }
18684                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18685                 if (get_jenv_res == JNI_EDETACHED) {
18686                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18687                 }
18688                 FREE(j_calls);
18689         }
18690 }
18691 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
18692         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
18693         JNIEnv *env;
18694         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18695         if (get_jenv_res == JNI_EDETACHED) {
18696                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18697         } else {
18698                 DO_ASSERT(get_jenv_res == JNI_OK);
18699         }
18700         int16_t message_type_conv = message_type;
18701         LDKu8slice buffer_var = buffer;
18702         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
18703         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
18704         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18705         CHECK(obj != NULL);
18706         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
18707         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18708                 (*env)->ExceptionDescribe(env);
18709                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
18710         }
18711         void* ret_ptr = untag_ptr(ret);
18712         CHECK_ACCESS(ret_ptr);
18713         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
18714         FREE(untag_ptr(ret));
18715         if (get_jenv_res == JNI_EDETACHED) {
18716                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18717         }
18718         return ret_conv;
18719 }
18720 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
18721         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
18722         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18723 }
18724 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
18725         jclass c = (*env)->GetObjectClass(env, o);
18726         CHECK(c != NULL);
18727         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
18728         atomic_init(&calls->refcnt, 1);
18729         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18730         calls->o = (*env)->NewWeakGlobalRef(env, o);
18731         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
18732         CHECK(calls->read_meth != NULL);
18733
18734         LDKCustomMessageReader ret = {
18735                 .this_arg = (void*) calls,
18736                 .read = read_LDKCustomMessageReader_jcall,
18737                 .free = LDKCustomMessageReader_JCalls_free,
18738         };
18739         return ret;
18740 }
18741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
18742         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
18743         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
18744         return tag_ptr(res_ptr, true);
18745 }
18746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read(JNIEnv *env, jclass clz, int64_t this_arg, int16_t message_type, int8_tArray buffer) {
18747         void* this_arg_ptr = untag_ptr(this_arg);
18748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18749         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
18750         LDKu8slice buffer_ref;
18751         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
18752         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
18753         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18754         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
18755         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
18756         return tag_ptr(ret_conv, true);
18757 }
18758
18759 typedef struct LDKCustomMessageHandler_JCalls {
18760         atomic_size_t refcnt;
18761         JavaVM *vm;
18762         jweak o;
18763         LDKCustomMessageReader_JCalls* CustomMessageReader;
18764         jmethodID handle_custom_message_meth;
18765         jmethodID get_and_clear_pending_msg_meth;
18766         jmethodID provided_node_features_meth;
18767         jmethodID provided_init_features_meth;
18768 } LDKCustomMessageHandler_JCalls;
18769 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
18770         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18771         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18772                 JNIEnv *env;
18773                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18774                 if (get_jenv_res == JNI_EDETACHED) {
18775                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18776                 } else {
18777                         DO_ASSERT(get_jenv_res == JNI_OK);
18778                 }
18779                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18780                 if (get_jenv_res == JNI_EDETACHED) {
18781                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18782                 }
18783                 FREE(j_calls);
18784         }
18785 }
18786 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
18787         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18788         JNIEnv *env;
18789         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18790         if (get_jenv_res == JNI_EDETACHED) {
18791                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18792         } else {
18793                 DO_ASSERT(get_jenv_res == JNI_OK);
18794         }
18795         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
18796         *msg_ret = msg;
18797         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
18798         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
18799         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18800         CHECK(obj != NULL);
18801         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
18802         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18803                 (*env)->ExceptionDescribe(env);
18804                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
18805         }
18806         void* ret_ptr = untag_ptr(ret);
18807         CHECK_ACCESS(ret_ptr);
18808         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18809         FREE(untag_ptr(ret));
18810         if (get_jenv_res == JNI_EDETACHED) {
18811                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18812         }
18813         return ret_conv;
18814 }
18815 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
18816         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18817         JNIEnv *env;
18818         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18819         if (get_jenv_res == JNI_EDETACHED) {
18820                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18821         } else {
18822                 DO_ASSERT(get_jenv_res == JNI_OK);
18823         }
18824         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18825         CHECK(obj != NULL);
18826         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
18827         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18828                 (*env)->ExceptionDescribe(env);
18829                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
18830         }
18831         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
18832         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
18833         if (ret_constr.datalen > 0)
18834                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18835         else
18836                 ret_constr.data = NULL;
18837         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
18838         for (size_t z = 0; z < ret_constr.datalen; z++) {
18839                 int64_t ret_conv_25 = ret_vals[z];
18840                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
18841                 CHECK_ACCESS(ret_conv_25_ptr);
18842                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
18843                 FREE(untag_ptr(ret_conv_25));
18844                 ret_constr.data[z] = ret_conv_25_conv;
18845         }
18846         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
18847         if (get_jenv_res == JNI_EDETACHED) {
18848                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18849         }
18850         return ret_constr;
18851 }
18852 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
18853         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18854         JNIEnv *env;
18855         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18856         if (get_jenv_res == JNI_EDETACHED) {
18857                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18858         } else {
18859                 DO_ASSERT(get_jenv_res == JNI_OK);
18860         }
18861         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18862         CHECK(obj != NULL);
18863         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18864         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18865                 (*env)->ExceptionDescribe(env);
18866                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
18867         }
18868         LDKNodeFeatures ret_conv;
18869         ret_conv.inner = untag_ptr(ret);
18870         ret_conv.is_owned = ptr_is_owned(ret);
18871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18872         if (get_jenv_res == JNI_EDETACHED) {
18873                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18874         }
18875         return ret_conv;
18876 }
18877 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18878         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
18879         JNIEnv *env;
18880         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18881         if (get_jenv_res == JNI_EDETACHED) {
18882                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18883         } else {
18884                 DO_ASSERT(get_jenv_res == JNI_OK);
18885         }
18886         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18887         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18888         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18889         CHECK(obj != NULL);
18890         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18891         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18892                 (*env)->ExceptionDescribe(env);
18893                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
18894         }
18895         LDKInitFeatures ret_conv;
18896         ret_conv.inner = untag_ptr(ret);
18897         ret_conv.is_owned = ptr_is_owned(ret);
18898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18899         if (get_jenv_res == JNI_EDETACHED) {
18900                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18901         }
18902         return ret_conv;
18903 }
18904 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
18905         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
18906         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18907         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
18908 }
18909 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
18910         jclass c = (*env)->GetObjectClass(env, o);
18911         CHECK(c != NULL);
18912         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
18913         atomic_init(&calls->refcnt, 1);
18914         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18915         calls->o = (*env)->NewWeakGlobalRef(env, o);
18916         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
18917         CHECK(calls->handle_custom_message_meth != NULL);
18918         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
18919         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
18920         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18921         CHECK(calls->provided_node_features_meth != NULL);
18922         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18923         CHECK(calls->provided_init_features_meth != NULL);
18924
18925         LDKCustomMessageHandler ret = {
18926                 .this_arg = (void*) calls,
18927                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
18928                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
18929                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
18930                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
18931                 .free = LDKCustomMessageHandler_JCalls_free,
18932                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
18933         };
18934         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
18935         return ret;
18936 }
18937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
18938         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
18939         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
18940         return tag_ptr(res_ptr, true);
18941 }
18942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
18943         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
18944         return tag_ptr(&inp->CustomMessageReader, false);
18945 }
18946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
18947         void* this_arg_ptr = untag_ptr(this_arg);
18948         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18949         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18950         void* msg_ptr = untag_ptr(msg);
18951         CHECK_ACCESS(msg_ptr);
18952         LDKType msg_conv = *(LDKType*)(msg_ptr);
18953         if (msg_conv.free == LDKType_JCalls_free) {
18954                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18955                 LDKType_JCalls_cloned(&msg_conv);
18956         }
18957         LDKPublicKey sender_node_id_ref;
18958         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
18959         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
18960         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18961         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
18962         return tag_ptr(ret_conv, true);
18963 }
18964
18965 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
18966         void* this_arg_ptr = untag_ptr(this_arg);
18967         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18968         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18969         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
18970         int64_tArray ret_arr = NULL;
18971         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18972         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18973         for (size_t z = 0; z < ret_var.datalen; z++) {
18974                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18975                 *ret_conv_25_conv = ret_var.data[z];
18976                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
18977         }
18978         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18979         FREE(ret_var.data);
18980         return ret_arr;
18981 }
18982
18983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
18984         void* this_arg_ptr = untag_ptr(this_arg);
18985         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18986         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18987         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
18988         int64_t ret_ref = 0;
18989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18991         return ret_ref;
18992 }
18993
18994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
18995         void* this_arg_ptr = untag_ptr(this_arg);
18996         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18997         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18998         LDKPublicKey their_node_id_ref;
18999         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19000         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19001         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
19002         int64_t ret_ref = 0;
19003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19005         return ret_ref;
19006 }
19007
19008 typedef struct LDKOffersMessageHandler_JCalls {
19009         atomic_size_t refcnt;
19010         JavaVM *vm;
19011         jweak o;
19012         jmethodID handle_message_meth;
19013 } LDKOffersMessageHandler_JCalls;
19014 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
19015         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19016         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19017                 JNIEnv *env;
19018                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19019                 if (get_jenv_res == JNI_EDETACHED) {
19020                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19021                 } else {
19022                         DO_ASSERT(get_jenv_res == JNI_OK);
19023                 }
19024                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19025                 if (get_jenv_res == JNI_EDETACHED) {
19026                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19027                 }
19028                 FREE(j_calls);
19029         }
19030 }
19031 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
19032         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19033         JNIEnv *env;
19034         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19035         if (get_jenv_res == JNI_EDETACHED) {
19036                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19037         } else {
19038                 DO_ASSERT(get_jenv_res == JNI_OK);
19039         }
19040         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
19041         *message_copy = message;
19042         int64_t message_ref = tag_ptr(message_copy, true);
19043         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19044         CHECK(obj != NULL);
19045         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
19046         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19047                 (*env)->ExceptionDescribe(env);
19048                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
19049         }
19050         void* ret_ptr = untag_ptr(ret);
19051         CHECK_ACCESS(ret_ptr);
19052         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
19053         FREE(untag_ptr(ret));
19054         if (get_jenv_res == JNI_EDETACHED) {
19055                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19056         }
19057         return ret_conv;
19058 }
19059 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
19060         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
19061         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19062 }
19063 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
19064         jclass c = (*env)->GetObjectClass(env, o);
19065         CHECK(c != NULL);
19066         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
19067         atomic_init(&calls->refcnt, 1);
19068         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19069         calls->o = (*env)->NewWeakGlobalRef(env, o);
19070         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
19071         CHECK(calls->handle_message_meth != NULL);
19072
19073         LDKOffersMessageHandler ret = {
19074                 .this_arg = (void*) calls,
19075                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
19076                 .free = LDKOffersMessageHandler_JCalls_free,
19077         };
19078         return ret;
19079 }
19080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
19081         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
19082         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
19083         return tag_ptr(res_ptr, true);
19084 }
19085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
19086         void* this_arg_ptr = untag_ptr(this_arg);
19087         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19088         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
19089         void* message_ptr = untag_ptr(message);
19090         CHECK_ACCESS(message_ptr);
19091         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
19092         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
19093         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
19094         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
19095         int64_t ret_ref = tag_ptr(ret_copy, true);
19096         return ret_ref;
19097 }
19098
19099 typedef struct LDKCustomOnionMessageHandler_JCalls {
19100         atomic_size_t refcnt;
19101         JavaVM *vm;
19102         jweak o;
19103         jmethodID handle_custom_message_meth;
19104         jmethodID read_custom_message_meth;
19105 } LDKCustomOnionMessageHandler_JCalls;
19106 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
19107         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19108         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19109                 JNIEnv *env;
19110                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19111                 if (get_jenv_res == JNI_EDETACHED) {
19112                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19113                 } else {
19114                         DO_ASSERT(get_jenv_res == JNI_OK);
19115                 }
19116                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19117                 if (get_jenv_res == JNI_EDETACHED) {
19118                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19119                 }
19120                 FREE(j_calls);
19121         }
19122 }
19123 LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
19124         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19125         JNIEnv *env;
19126         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19127         if (get_jenv_res == JNI_EDETACHED) {
19128                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19129         } else {
19130                 DO_ASSERT(get_jenv_res == JNI_OK);
19131         }
19132         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
19133         *msg_ret = msg;
19134         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19135         CHECK(obj != NULL);
19136         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
19137         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19138                 (*env)->ExceptionDescribe(env);
19139                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
19140         }
19141         void* ret_ptr = untag_ptr(ret);
19142         CHECK_ACCESS(ret_ptr);
19143         LDKCOption_CustomOnionMessageContentsZ ret_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(ret_ptr);
19144         FREE(untag_ptr(ret));
19145         if (get_jenv_res == JNI_EDETACHED) {
19146                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19147         }
19148         return ret_conv;
19149 }
19150 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
19151         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19152         JNIEnv *env;
19153         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19154         if (get_jenv_res == JNI_EDETACHED) {
19155                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19156         } else {
19157                 DO_ASSERT(get_jenv_res == JNI_OK);
19158         }
19159         int64_t message_type_conv = message_type;
19160         LDKu8slice buffer_var = buffer;
19161         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
19162         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
19163         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19164         CHECK(obj != NULL);
19165         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
19166         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19167                 (*env)->ExceptionDescribe(env);
19168                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
19169         }
19170         void* ret_ptr = untag_ptr(ret);
19171         CHECK_ACCESS(ret_ptr);
19172         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
19173         FREE(untag_ptr(ret));
19174         if (get_jenv_res == JNI_EDETACHED) {
19175                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19176         }
19177         return ret_conv;
19178 }
19179 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
19180         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
19181         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19182 }
19183 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
19184         jclass c = (*env)->GetObjectClass(env, o);
19185         CHECK(c != NULL);
19186         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
19187         atomic_init(&calls->refcnt, 1);
19188         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19189         calls->o = (*env)->NewWeakGlobalRef(env, o);
19190         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
19191         CHECK(calls->handle_custom_message_meth != NULL);
19192         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
19193         CHECK(calls->read_custom_message_meth != NULL);
19194
19195         LDKCustomOnionMessageHandler ret = {
19196                 .this_arg = (void*) calls,
19197                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
19198                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
19199                 .free = LDKCustomOnionMessageHandler_JCalls_free,
19200         };
19201         return ret;
19202 }
19203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
19204         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
19205         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
19206         return tag_ptr(res_ptr, true);
19207 }
19208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19209         void* this_arg_ptr = untag_ptr(this_arg);
19210         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19211         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19212         void* msg_ptr = untag_ptr(msg);
19213         CHECK_ACCESS(msg_ptr);
19214         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
19215         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
19216                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19217                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
19218         }
19219         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
19220         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
19221         int64_t ret_ref = tag_ptr(ret_copy, true);
19222         return ret_ref;
19223 }
19224
19225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1read_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message_type, int8_tArray buffer) {
19226         void* this_arg_ptr = untag_ptr(this_arg);
19227         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19228         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19229         LDKu8slice buffer_ref;
19230         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
19231         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
19232         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
19233         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
19234         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
19235         return tag_ptr(ret_conv, true);
19236 }
19237
19238 typedef struct LDKSocketDescriptor_JCalls {
19239         atomic_size_t refcnt;
19240         JavaVM *vm;
19241         jweak o;
19242         jmethodID send_data_meth;
19243         jmethodID disconnect_socket_meth;
19244         jmethodID eq_meth;
19245         jmethodID hash_meth;
19246 } LDKSocketDescriptor_JCalls;
19247 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
19248         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19249         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19250                 JNIEnv *env;
19251                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19252                 if (get_jenv_res == JNI_EDETACHED) {
19253                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19254                 } else {
19255                         DO_ASSERT(get_jenv_res == JNI_OK);
19256                 }
19257                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19258                 if (get_jenv_res == JNI_EDETACHED) {
19259                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19260                 }
19261                 FREE(j_calls);
19262         }
19263 }
19264 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
19265         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19266         JNIEnv *env;
19267         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19268         if (get_jenv_res == JNI_EDETACHED) {
19269                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19270         } else {
19271                 DO_ASSERT(get_jenv_res == JNI_OK);
19272         }
19273         LDKu8slice data_var = data;
19274         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
19275         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
19276         jboolean resume_read_conv = resume_read;
19277         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19278         CHECK(obj != NULL);
19279         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
19280         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19281                 (*env)->ExceptionDescribe(env);
19282                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
19283         }
19284         if (get_jenv_res == JNI_EDETACHED) {
19285                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19286         }
19287         return ret;
19288 }
19289 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
19290         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19291         JNIEnv *env;
19292         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19293         if (get_jenv_res == JNI_EDETACHED) {
19294                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19295         } else {
19296                 DO_ASSERT(get_jenv_res == JNI_OK);
19297         }
19298         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19299         CHECK(obj != NULL);
19300         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
19301         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19302                 (*env)->ExceptionDescribe(env);
19303                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
19304         }
19305         if (get_jenv_res == JNI_EDETACHED) {
19306                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19307         }
19308 }
19309 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
19310         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19311         JNIEnv *env;
19312         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19313         if (get_jenv_res == JNI_EDETACHED) {
19314                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19315         } else {
19316                 DO_ASSERT(get_jenv_res == JNI_OK);
19317         }
19318         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19319         *other_arg_clone = SocketDescriptor_clone(other_arg);
19320         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19321         CHECK(obj != NULL);
19322         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
19323         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19324                 (*env)->ExceptionDescribe(env);
19325                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
19326         }
19327         if (get_jenv_res == JNI_EDETACHED) {
19328                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19329         }
19330         return ret;
19331 }
19332 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
19333         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19334         JNIEnv *env;
19335         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19336         if (get_jenv_res == JNI_EDETACHED) {
19337                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19338         } else {
19339                 DO_ASSERT(get_jenv_res == JNI_OK);
19340         }
19341         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19342         CHECK(obj != NULL);
19343         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
19344         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19345                 (*env)->ExceptionDescribe(env);
19346                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
19347         }
19348         if (get_jenv_res == JNI_EDETACHED) {
19349                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19350         }
19351         return ret;
19352 }
19353 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
19354         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
19355         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19356 }
19357 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
19358         jclass c = (*env)->GetObjectClass(env, o);
19359         CHECK(c != NULL);
19360         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
19361         atomic_init(&calls->refcnt, 1);
19362         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19363         calls->o = (*env)->NewWeakGlobalRef(env, o);
19364         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
19365         CHECK(calls->send_data_meth != NULL);
19366         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
19367         CHECK(calls->disconnect_socket_meth != NULL);
19368         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
19369         CHECK(calls->eq_meth != NULL);
19370         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
19371         CHECK(calls->hash_meth != NULL);
19372
19373         LDKSocketDescriptor ret = {
19374                 .this_arg = (void*) calls,
19375                 .send_data = send_data_LDKSocketDescriptor_jcall,
19376                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
19377                 .eq = eq_LDKSocketDescriptor_jcall,
19378                 .hash = hash_LDKSocketDescriptor_jcall,
19379                 .cloned = LDKSocketDescriptor_JCalls_cloned,
19380                 .free = LDKSocketDescriptor_JCalls_free,
19381         };
19382         return ret;
19383 }
19384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
19385         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19386         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
19387         return tag_ptr(res_ptr, true);
19388 }
19389 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) {
19390         void* this_arg_ptr = untag_ptr(this_arg);
19391         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19392         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19393         LDKu8slice data_ref;
19394         data_ref.datalen = (*env)->GetArrayLength(env, data);
19395         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
19396         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
19397         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
19398         return ret_conv;
19399 }
19400
19401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
19402         void* this_arg_ptr = untag_ptr(this_arg);
19403         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19404         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19405         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
19406 }
19407
19408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
19409         void* this_arg_ptr = untag_ptr(this_arg);
19410         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19411         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19412         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
19413         return ret_conv;
19414 }
19415
19416 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
19417 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
19418 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
19419 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
19420 static jclass LDKEffectiveCapacity_Total_class = NULL;
19421 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
19422 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
19423 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
19424 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
19425 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
19426 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
19427 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
19428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
19429         LDKEffectiveCapacity_ExactLiquidity_class =
19430                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
19431         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
19432         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
19433         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
19434         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
19435                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
19436         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
19437         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
19438         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
19439         LDKEffectiveCapacity_Total_class =
19440                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
19441         CHECK(LDKEffectiveCapacity_Total_class != NULL);
19442         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
19443         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
19444         LDKEffectiveCapacity_Infinite_class =
19445                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
19446         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
19447         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
19448         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
19449         LDKEffectiveCapacity_HintMaxHTLC_class =
19450                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
19451         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
19452         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
19453         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
19454         LDKEffectiveCapacity_Unknown_class =
19455                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
19456         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
19457         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
19458         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
19459 }
19460 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19461         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
19462         switch(obj->tag) {
19463                 case LDKEffectiveCapacity_ExactLiquidity: {
19464                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
19465                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
19466                 }
19467                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
19468                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
19469                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
19470                 }
19471                 case LDKEffectiveCapacity_Total: {
19472                         int64_t capacity_msat_conv = obj->total.capacity_msat;
19473                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
19474                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
19475                 }
19476                 case LDKEffectiveCapacity_Infinite: {
19477                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
19478                 }
19479                 case LDKEffectiveCapacity_HintMaxHTLC: {
19480                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
19481                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
19482                 }
19483                 case LDKEffectiveCapacity_Unknown: {
19484                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
19485                 }
19486                 default: abort();
19487         }
19488 }
19489 static jclass LDKPayee_Blinded_class = NULL;
19490 static jmethodID LDKPayee_Blinded_meth = NULL;
19491 static jclass LDKPayee_Clear_class = NULL;
19492 static jmethodID LDKPayee_Clear_meth = NULL;
19493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
19494         LDKPayee_Blinded_class =
19495                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
19496         CHECK(LDKPayee_Blinded_class != NULL);
19497         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
19498         CHECK(LDKPayee_Blinded_meth != NULL);
19499         LDKPayee_Clear_class =
19500                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
19501         CHECK(LDKPayee_Clear_class != NULL);
19502         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
19503         CHECK(LDKPayee_Clear_meth != NULL);
19504 }
19505 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19506         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
19507         switch(obj->tag) {
19508                 case LDKPayee_Blinded: {
19509                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
19510                         int64_tArray route_hints_arr = NULL;
19511                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
19512                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
19513                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
19514                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
19515                                 *route_hints_conv_37_conv = route_hints_var.data[l];
19516                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
19517                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
19518                         }
19519                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
19520                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
19521                         int64_t features_ref = 0;
19522                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
19523                         features_ref = tag_ptr(features_var.inner, false);
19524                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
19525                 }
19526                 case LDKPayee_Clear: {
19527                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
19528                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
19529                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
19530                         int64_tArray route_hints_arr = NULL;
19531                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
19532                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
19533                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
19534                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
19535                                 int64_t route_hints_conv_11_ref = 0;
19536                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
19537                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
19538                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
19539                         }
19540                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
19541                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
19542                         int64_t features_ref = 0;
19543                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
19544                         features_ref = tag_ptr(features_var.inner, false);
19545                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
19546                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
19547                 }
19548                 default: abort();
19549         }
19550 }
19551 typedef struct LDKScore_JCalls {
19552         atomic_size_t refcnt;
19553         JavaVM *vm;
19554         jweak o;
19555         LDKScoreLookUp_JCalls* ScoreLookUp;
19556         LDKScoreUpdate_JCalls* ScoreUpdate;
19557         jmethodID write_meth;
19558 } LDKScore_JCalls;
19559 static void LDKScore_JCalls_free(void* this_arg) {
19560         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
19561         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19562                 JNIEnv *env;
19563                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19564                 if (get_jenv_res == JNI_EDETACHED) {
19565                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19566                 } else {
19567                         DO_ASSERT(get_jenv_res == JNI_OK);
19568                 }
19569                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19570                 if (get_jenv_res == JNI_EDETACHED) {
19571                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19572                 }
19573                 FREE(j_calls);
19574         }
19575 }
19576 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
19577         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
19578         JNIEnv *env;
19579         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19580         if (get_jenv_res == JNI_EDETACHED) {
19581                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19582         } else {
19583                 DO_ASSERT(get_jenv_res == JNI_OK);
19584         }
19585         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19586         CHECK(obj != NULL);
19587         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
19588         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19589                 (*env)->ExceptionDescribe(env);
19590                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
19591         }
19592         LDKCVec_u8Z ret_ref;
19593         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
19594         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
19595         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
19596         if (get_jenv_res == JNI_EDETACHED) {
19597                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19598         }
19599         return ret_ref;
19600 }
19601 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
19602         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
19603         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19604         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
19605         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
19606 }
19607 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
19608         jclass c = (*env)->GetObjectClass(env, o);
19609         CHECK(c != NULL);
19610         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
19611         atomic_init(&calls->refcnt, 1);
19612         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19613         calls->o = (*env)->NewWeakGlobalRef(env, o);
19614         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
19615         CHECK(calls->write_meth != NULL);
19616
19617         LDKScore ret = {
19618                 .this_arg = (void*) calls,
19619                 .write = write_LDKScore_jcall,
19620                 .free = LDKScore_JCalls_free,
19621                 .ScoreLookUp = LDKScoreLookUp_init(env, clz, ScoreLookUp),
19622                 .ScoreUpdate = LDKScoreUpdate_init(env, clz, ScoreUpdate),
19623         };
19624         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
19625         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
19626         return ret;
19627 }
19628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
19629         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
19630         *res_ptr = LDKScore_init(env, clz, o, ScoreLookUp, ScoreUpdate);
19631         return tag_ptr(res_ptr, true);
19632 }
19633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t arg) {
19634         LDKScore *inp = (LDKScore *)untag_ptr(arg);
19635         return tag_ptr(&inp->ScoreLookUp, false);
19636 }
19637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t arg) {
19638         LDKScore *inp = (LDKScore *)untag_ptr(arg);
19639         return tag_ptr(&inp->ScoreUpdate, false);
19640 }
19641 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
19642         void* this_arg_ptr = untag_ptr(this_arg);
19643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19644         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
19645         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
19646         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19647         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19648         CVec_u8Z_free(ret_var);
19649         return ret_arr;
19650 }
19651
19652 static jclass LDKDestination_Node_class = NULL;
19653 static jmethodID LDKDestination_Node_meth = NULL;
19654 static jclass LDKDestination_BlindedPath_class = NULL;
19655 static jmethodID LDKDestination_BlindedPath_meth = NULL;
19656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
19657         LDKDestination_Node_class =
19658                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
19659         CHECK(LDKDestination_Node_class != NULL);
19660         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
19661         CHECK(LDKDestination_Node_meth != NULL);
19662         LDKDestination_BlindedPath_class =
19663                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
19664         CHECK(LDKDestination_BlindedPath_class != NULL);
19665         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
19666         CHECK(LDKDestination_BlindedPath_meth != NULL);
19667 }
19668 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19669         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
19670         switch(obj->tag) {
19671                 case LDKDestination_Node: {
19672                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
19673                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
19674                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
19675                 }
19676                 case LDKDestination_BlindedPath: {
19677                         LDKBlindedPath blinded_path_var = obj->blinded_path;
19678                         int64_t blinded_path_ref = 0;
19679                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
19680                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
19681                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
19682                 }
19683                 default: abort();
19684         }
19685 }
19686 typedef struct LDKMessageRouter_JCalls {
19687         atomic_size_t refcnt;
19688         JavaVM *vm;
19689         jweak o;
19690         jmethodID find_path_meth;
19691 } LDKMessageRouter_JCalls;
19692 static void LDKMessageRouter_JCalls_free(void* this_arg) {
19693         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
19694         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19695                 JNIEnv *env;
19696                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19697                 if (get_jenv_res == JNI_EDETACHED) {
19698                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19699                 } else {
19700                         DO_ASSERT(get_jenv_res == JNI_OK);
19701                 }
19702                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19703                 if (get_jenv_res == JNI_EDETACHED) {
19704                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19705                 }
19706                 FREE(j_calls);
19707         }
19708 }
19709 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
19710         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
19711         JNIEnv *env;
19712         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19713         if (get_jenv_res == JNI_EDETACHED) {
19714                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19715         } else {
19716                 DO_ASSERT(get_jenv_res == JNI_OK);
19717         }
19718         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
19719         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
19720         LDKCVec_PublicKeyZ peers_var = peers;
19721         jobjectArray peers_arr = NULL;
19722         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
19723         ;
19724         for (size_t i = 0; i < peers_var.datalen; i++) {
19725                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
19726                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
19727                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
19728         }
19729         
19730         FREE(peers_var.data);
19731         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
19732         *destination_copy = destination;
19733         int64_t destination_ref = tag_ptr(destination_copy, true);
19734         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19735         CHECK(obj != NULL);
19736         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
19737         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19738                 (*env)->ExceptionDescribe(env);
19739                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
19740         }
19741         void* ret_ptr = untag_ptr(ret);
19742         CHECK_ACCESS(ret_ptr);
19743         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
19744         FREE(untag_ptr(ret));
19745         if (get_jenv_res == JNI_EDETACHED) {
19746                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19747         }
19748         return ret_conv;
19749 }
19750 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
19751         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
19752         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19753 }
19754 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
19755         jclass c = (*env)->GetObjectClass(env, o);
19756         CHECK(c != NULL);
19757         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
19758         atomic_init(&calls->refcnt, 1);
19759         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19760         calls->o = (*env)->NewWeakGlobalRef(env, o);
19761         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
19762         CHECK(calls->find_path_meth != NULL);
19763
19764         LDKMessageRouter ret = {
19765                 .this_arg = (void*) calls,
19766                 .find_path = find_path_LDKMessageRouter_jcall,
19767                 .free = LDKMessageRouter_JCalls_free,
19768         };
19769         return ret;
19770 }
19771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
19772         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
19773         *res_ptr = LDKMessageRouter_init(env, clz, o);
19774         return tag_ptr(res_ptr, true);
19775 }
19776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageRouter_1find_1path(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray sender, jobjectArray peers, int64_t destination) {
19777         void* this_arg_ptr = untag_ptr(this_arg);
19778         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19779         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
19780         LDKPublicKey sender_ref;
19781         CHECK((*env)->GetArrayLength(env, sender) == 33);
19782         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
19783         LDKCVec_PublicKeyZ peers_constr;
19784         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
19785         if (peers_constr.datalen > 0)
19786                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
19787         else
19788                 peers_constr.data = NULL;
19789         for (size_t i = 0; i < peers_constr.datalen; i++) {
19790                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
19791                 LDKPublicKey peers_conv_8_ref;
19792                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
19793                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
19794                 peers_constr.data[i] = peers_conv_8_ref;
19795         }
19796         void* destination_ptr = untag_ptr(destination);
19797         CHECK_ACCESS(destination_ptr);
19798         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
19799         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
19800         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19801         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
19802         return tag_ptr(ret_conv, true);
19803 }
19804
19805 static jclass LDKOnionMessageContents_Offers_class = NULL;
19806 static jmethodID LDKOnionMessageContents_Offers_meth = NULL;
19807 static jclass LDKOnionMessageContents_Custom_class = NULL;
19808 static jmethodID LDKOnionMessageContents_Custom_meth = NULL;
19809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOnionMessageContents_init (JNIEnv *env, jclass clz) {
19810         LDKOnionMessageContents_Offers_class =
19811                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Offers"));
19812         CHECK(LDKOnionMessageContents_Offers_class != NULL);
19813         LDKOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Offers_class, "<init>", "(J)V");
19814         CHECK(LDKOnionMessageContents_Offers_meth != NULL);
19815         LDKOnionMessageContents_Custom_class =
19816                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Custom"));
19817         CHECK(LDKOnionMessageContents_Custom_class != NULL);
19818         LDKOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Custom_class, "<init>", "(J)V");
19819         CHECK(LDKOnionMessageContents_Custom_meth != NULL);
19820 }
19821 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19822         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
19823         switch(obj->tag) {
19824                 case LDKOnionMessageContents_Offers: {
19825                         int64_t offers_ref = tag_ptr(&obj->offers, false);
19826                         return (*env)->NewObject(env, LDKOnionMessageContents_Offers_class, LDKOnionMessageContents_Offers_meth, offers_ref);
19827                 }
19828                 case LDKOnionMessageContents_Custom: {
19829                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
19830                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
19831                         return (*env)->NewObject(env, LDKOnionMessageContents_Custom_class, LDKOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
19832                 }
19833                 default: abort();
19834         }
19835 }
19836 typedef struct LDKCoinSelectionSource_JCalls {
19837         atomic_size_t refcnt;
19838         JavaVM *vm;
19839         jweak o;
19840         jmethodID select_confirmed_utxos_meth;
19841         jmethodID sign_tx_meth;
19842 } LDKCoinSelectionSource_JCalls;
19843 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
19844         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
19845         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19846                 JNIEnv *env;
19847                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19848                 if (get_jenv_res == JNI_EDETACHED) {
19849                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19850                 } else {
19851                         DO_ASSERT(get_jenv_res == JNI_OK);
19852                 }
19853                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19854                 if (get_jenv_res == JNI_EDETACHED) {
19855                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19856                 }
19857                 FREE(j_calls);
19858         }
19859 }
19860 LDKCResult_CoinSelectionNoneZ select_confirmed_utxos_LDKCoinSelectionSource_jcall(const void* this_arg, LDKThirtyTwoBytes claim_id, LDKCVec_InputZ must_spend, LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight) {
19861         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
19862         JNIEnv *env;
19863         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19864         if (get_jenv_res == JNI_EDETACHED) {
19865                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19866         } else {
19867                 DO_ASSERT(get_jenv_res == JNI_OK);
19868         }
19869         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
19870         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
19871         LDKCVec_InputZ must_spend_var = must_spend;
19872         int64_tArray must_spend_arr = NULL;
19873         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
19874         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
19875         for (size_t h = 0; h < must_spend_var.datalen; h++) {
19876                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
19877                 int64_t must_spend_conv_7_ref = 0;
19878                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
19879                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
19880                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
19881         }
19882         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
19883         FREE(must_spend_var.data);
19884         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
19885         int64_tArray must_pay_to_arr = NULL;
19886         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
19887         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
19888         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
19889                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
19890                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
19891                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
19892         }
19893         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
19894         FREE(must_pay_to_var.data);
19895         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
19896         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19897         CHECK(obj != NULL);
19898         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->select_confirmed_utxos_meth, claim_id_arr, must_spend_arr, must_pay_to_arr, target_feerate_sat_per_1000_weight_conv);
19899         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19900                 (*env)->ExceptionDescribe(env);
19901                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
19902         }
19903         void* ret_ptr = untag_ptr(ret);
19904         CHECK_ACCESS(ret_ptr);
19905         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
19906         FREE(untag_ptr(ret));
19907         if (get_jenv_res == JNI_EDETACHED) {
19908                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19909         }
19910         return ret_conv;
19911 }
19912 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
19913         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
19914         JNIEnv *env;
19915         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19916         if (get_jenv_res == JNI_EDETACHED) {
19917                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19918         } else {
19919                 DO_ASSERT(get_jenv_res == JNI_OK);
19920         }
19921         LDKTransaction tx_var = tx;
19922         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
19923         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
19924         Transaction_free(tx_var);
19925         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19926         CHECK(obj != NULL);
19927         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
19928         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19929                 (*env)->ExceptionDescribe(env);
19930                 (*env)->FatalError(env, "A call to sign_tx in LDKCoinSelectionSource from rust threw an exception.");
19931         }
19932         void* ret_ptr = untag_ptr(ret);
19933         CHECK_ACCESS(ret_ptr);
19934         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
19935         FREE(untag_ptr(ret));
19936         if (get_jenv_res == JNI_EDETACHED) {
19937                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19938         }
19939         return ret_conv;
19940 }
19941 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
19942         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
19943         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19944 }
19945 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
19946         jclass c = (*env)->GetObjectClass(env, o);
19947         CHECK(c != NULL);
19948         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
19949         atomic_init(&calls->refcnt, 1);
19950         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19951         calls->o = (*env)->NewWeakGlobalRef(env, o);
19952         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
19953         CHECK(calls->select_confirmed_utxos_meth != NULL);
19954         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
19955         CHECK(calls->sign_tx_meth != NULL);
19956
19957         LDKCoinSelectionSource ret = {
19958                 .this_arg = (void*) calls,
19959                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
19960                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
19961                 .free = LDKCoinSelectionSource_JCalls_free,
19962         };
19963         return ret;
19964 }
19965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
19966         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
19967         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
19968         return tag_ptr(res_ptr, true);
19969 }
19970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1select_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray claim_id, int64_tArray must_spend, int64_tArray must_pay_to, int32_t target_feerate_sat_per_1000_weight) {
19971         void* this_arg_ptr = untag_ptr(this_arg);
19972         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19973         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
19974         LDKThirtyTwoBytes claim_id_ref;
19975         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
19976         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
19977         LDKCVec_InputZ must_spend_constr;
19978         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
19979         if (must_spend_constr.datalen > 0)
19980                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
19981         else
19982                 must_spend_constr.data = NULL;
19983         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
19984         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
19985                 int64_t must_spend_conv_7 = must_spend_vals[h];
19986                 LDKInput must_spend_conv_7_conv;
19987                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
19988                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
19989                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
19990                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
19991                 must_spend_constr.data[h] = must_spend_conv_7_conv;
19992         }
19993         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
19994         LDKCVec_TxOutZ must_pay_to_constr;
19995         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
19996         if (must_pay_to_constr.datalen > 0)
19997                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19998         else
19999                 must_pay_to_constr.data = NULL;
20000         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
20001         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
20002                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
20003                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
20004                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
20005                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
20006                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
20007                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
20008         }
20009         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
20010         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20011         *ret_conv = (this_arg_conv->select_confirmed_utxos)(this_arg_conv->this_arg, claim_id_ref, must_spend_constr, must_pay_to_constr, target_feerate_sat_per_1000_weight);
20012         return tag_ptr(ret_conv, true);
20013 }
20014
20015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
20016         void* this_arg_ptr = untag_ptr(this_arg);
20017         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20018         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
20019         LDKTransaction tx_ref;
20020         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
20021         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
20022         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
20023         tx_ref.data_is_owned = true;
20024         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20025         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
20026         return tag_ptr(ret_conv, true);
20027 }
20028
20029 typedef struct LDKWalletSource_JCalls {
20030         atomic_size_t refcnt;
20031         JavaVM *vm;
20032         jweak o;
20033         jmethodID list_confirmed_utxos_meth;
20034         jmethodID get_change_script_meth;
20035         jmethodID sign_tx_meth;
20036 } LDKWalletSource_JCalls;
20037 static void LDKWalletSource_JCalls_free(void* this_arg) {
20038         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20039         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20040                 JNIEnv *env;
20041                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20042                 if (get_jenv_res == JNI_EDETACHED) {
20043                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20044                 } else {
20045                         DO_ASSERT(get_jenv_res == JNI_OK);
20046                 }
20047                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20048                 if (get_jenv_res == JNI_EDETACHED) {
20049                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20050                 }
20051                 FREE(j_calls);
20052         }
20053 }
20054 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
20055         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20056         JNIEnv *env;
20057         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20058         if (get_jenv_res == JNI_EDETACHED) {
20059                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20060         } else {
20061                 DO_ASSERT(get_jenv_res == JNI_OK);
20062         }
20063         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20064         CHECK(obj != NULL);
20065         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
20066         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20067                 (*env)->ExceptionDescribe(env);
20068                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
20069         }
20070         void* ret_ptr = untag_ptr(ret);
20071         CHECK_ACCESS(ret_ptr);
20072         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
20073         FREE(untag_ptr(ret));
20074         if (get_jenv_res == JNI_EDETACHED) {
20075                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20076         }
20077         return ret_conv;
20078 }
20079 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
20080         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20081         JNIEnv *env;
20082         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20083         if (get_jenv_res == JNI_EDETACHED) {
20084                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20085         } else {
20086                 DO_ASSERT(get_jenv_res == JNI_OK);
20087         }
20088         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20089         CHECK(obj != NULL);
20090         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
20091         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20092                 (*env)->ExceptionDescribe(env);
20093                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
20094         }
20095         void* ret_ptr = untag_ptr(ret);
20096         CHECK_ACCESS(ret_ptr);
20097         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
20098         FREE(untag_ptr(ret));
20099         if (get_jenv_res == JNI_EDETACHED) {
20100                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20101         }
20102         return ret_conv;
20103 }
20104 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
20105         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20106         JNIEnv *env;
20107         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20108         if (get_jenv_res == JNI_EDETACHED) {
20109                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20110         } else {
20111                 DO_ASSERT(get_jenv_res == JNI_OK);
20112         }
20113         LDKTransaction tx_var = tx;
20114         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
20115         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
20116         Transaction_free(tx_var);
20117         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20118         CHECK(obj != NULL);
20119         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
20120         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20121                 (*env)->ExceptionDescribe(env);
20122                 (*env)->FatalError(env, "A call to sign_tx in LDKWalletSource from rust threw an exception.");
20123         }
20124         void* ret_ptr = untag_ptr(ret);
20125         CHECK_ACCESS(ret_ptr);
20126         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
20127         FREE(untag_ptr(ret));
20128         if (get_jenv_res == JNI_EDETACHED) {
20129                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20130         }
20131         return ret_conv;
20132 }
20133 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
20134         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
20135         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20136 }
20137 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
20138         jclass c = (*env)->GetObjectClass(env, o);
20139         CHECK(c != NULL);
20140         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
20141         atomic_init(&calls->refcnt, 1);
20142         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20143         calls->o = (*env)->NewWeakGlobalRef(env, o);
20144         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
20145         CHECK(calls->list_confirmed_utxos_meth != NULL);
20146         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
20147         CHECK(calls->get_change_script_meth != NULL);
20148         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
20149         CHECK(calls->sign_tx_meth != NULL);
20150
20151         LDKWalletSource ret = {
20152                 .this_arg = (void*) calls,
20153                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
20154                 .get_change_script = get_change_script_LDKWalletSource_jcall,
20155                 .sign_tx = sign_tx_LDKWalletSource_jcall,
20156                 .free = LDKWalletSource_JCalls_free,
20157         };
20158         return ret;
20159 }
20160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
20161         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
20162         *res_ptr = LDKWalletSource_init(env, clz, o);
20163         return tag_ptr(res_ptr, true);
20164 }
20165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
20166         void* this_arg_ptr = untag_ptr(this_arg);
20167         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20168         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20169         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20170         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
20171         return tag_ptr(ret_conv, true);
20172 }
20173
20174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
20175         void* this_arg_ptr = untag_ptr(this_arg);
20176         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20177         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20178         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20179         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
20180         return tag_ptr(ret_conv, true);
20181 }
20182
20183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
20184         void* this_arg_ptr = untag_ptr(this_arg);
20185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20186         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20187         LDKTransaction tx_ref;
20188         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
20189         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
20190         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
20191         tx_ref.data_is_owned = true;
20192         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20193         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
20194         return tag_ptr(ret_conv, true);
20195 }
20196
20197 static jclass LDKGossipSync_P2P_class = NULL;
20198 static jmethodID LDKGossipSync_P2P_meth = NULL;
20199 static jclass LDKGossipSync_Rapid_class = NULL;
20200 static jmethodID LDKGossipSync_Rapid_meth = NULL;
20201 static jclass LDKGossipSync_None_class = NULL;
20202 static jmethodID LDKGossipSync_None_meth = NULL;
20203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
20204         LDKGossipSync_P2P_class =
20205                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
20206         CHECK(LDKGossipSync_P2P_class != NULL);
20207         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
20208         CHECK(LDKGossipSync_P2P_meth != NULL);
20209         LDKGossipSync_Rapid_class =
20210                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
20211         CHECK(LDKGossipSync_Rapid_class != NULL);
20212         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
20213         CHECK(LDKGossipSync_Rapid_meth != NULL);
20214         LDKGossipSync_None_class =
20215                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
20216         CHECK(LDKGossipSync_None_class != NULL);
20217         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
20218         CHECK(LDKGossipSync_None_meth != NULL);
20219 }
20220 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
20221         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
20222         switch(obj->tag) {
20223                 case LDKGossipSync_P2P: {
20224                         LDKP2PGossipSync p2p_var = obj->p2p;
20225                         int64_t p2p_ref = 0;
20226                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
20227                         p2p_ref = tag_ptr(p2p_var.inner, false);
20228                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
20229                 }
20230                 case LDKGossipSync_Rapid: {
20231                         LDKRapidGossipSync rapid_var = obj->rapid;
20232                         int64_t rapid_ref = 0;
20233                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
20234                         rapid_ref = tag_ptr(rapid_var.inner, false);
20235                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
20236                 }
20237                 case LDKGossipSync_None: {
20238                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
20239                 }
20240                 default: abort();
20241         }
20242 }
20243 static jclass LDKFallback_SegWitProgram_class = NULL;
20244 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
20245 static jclass LDKFallback_PubKeyHash_class = NULL;
20246 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
20247 static jclass LDKFallback_ScriptHash_class = NULL;
20248 static jmethodID LDKFallback_ScriptHash_meth = NULL;
20249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
20250         LDKFallback_SegWitProgram_class =
20251                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
20252         CHECK(LDKFallback_SegWitProgram_class != NULL);
20253         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
20254         CHECK(LDKFallback_SegWitProgram_meth != NULL);
20255         LDKFallback_PubKeyHash_class =
20256                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
20257         CHECK(LDKFallback_PubKeyHash_class != NULL);
20258         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
20259         CHECK(LDKFallback_PubKeyHash_meth != NULL);
20260         LDKFallback_ScriptHash_class =
20261                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
20262         CHECK(LDKFallback_ScriptHash_class != NULL);
20263         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
20264         CHECK(LDKFallback_ScriptHash_meth != NULL);
20265 }
20266 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
20267         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
20268         switch(obj->tag) {
20269                 case LDKFallback_SegWitProgram: {
20270                         uint8_t version_val = obj->seg_wit_program.version._0;
20271                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
20272                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
20273                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
20274                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
20275                 }
20276                 case LDKFallback_PubKeyHash: {
20277                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
20278                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
20279                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
20280                 }
20281                 case LDKFallback_ScriptHash: {
20282                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
20283                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
20284                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
20285                 }
20286                 default: abort();
20287         }
20288 }
20289 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
20290         LDKStr ret_str = _ldk_get_compiled_version();
20291         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20292         Str_free(ret_str);
20293         return ret_conv;
20294 }
20295
20296 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
20297         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
20298         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20299         Str_free(ret_str);
20300         return ret_conv;
20301 }
20302
20303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
20304         LDKU128 val_ref;
20305         CHECK((*env)->GetArrayLength(env, val) == 16);
20306         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
20307         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
20308         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
20309         return ret_arr;
20310 }
20311
20312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
20313         LDKSixteenBytes le_bytes_ref;
20314         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
20315         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
20316         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
20317         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
20318         return ret_arr;
20319 }
20320
20321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
20322         LDKThirtyTwoBytes big_endian_bytes_ref;
20323         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
20324         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
20325         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
20326         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
20327         return tag_ptr(ret_ref, true);
20328 }
20329
20330 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
20331         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
20332         *ret_copy = Bech32Error_clone(arg);
20333         int64_t ret_ref = tag_ptr(ret_copy, true);
20334         return ret_ref;
20335 }
20336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20337         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
20338         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
20339         return ret_conv;
20340 }
20341
20342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20343         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
20344         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
20345         *ret_copy = Bech32Error_clone(orig_conv);
20346         int64_t ret_ref = tag_ptr(ret_copy, true);
20347         return ret_ref;
20348 }
20349
20350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
20351         if (!ptr_is_owned(o)) return;
20352         void* o_ptr = untag_ptr(o);
20353         CHECK_ACCESS(o_ptr);
20354         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
20355         FREE(untag_ptr(o));
20356         Bech32Error_free(o_conv);
20357 }
20358
20359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20360         LDKTransaction _res_ref;
20361         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20362         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
20363         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20364         _res_ref.data_is_owned = true;
20365         Transaction_free(_res_ref);
20366 }
20367
20368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20369         LDKWitness _res_ref;
20370         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20371         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
20372         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20373         _res_ref.data_is_owned = true;
20374         Witness_free(_res_ref);
20375 }
20376
20377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
20378         if (!ptr_is_owned(_res)) return;
20379         void* _res_ptr = untag_ptr(_res);
20380         CHECK_ACCESS(_res_ptr);
20381         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
20382         FREE(untag_ptr(_res));
20383         TxIn_free(_res_conv);
20384 }
20385
20386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxIn_1new(JNIEnv *env, jclass clz, int8_tArray witness, int8_tArray script_sig, int32_t sequence, int8_tArray previous_txid, int32_t previous_vout) {
20387         LDKWitness witness_ref;
20388         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
20389         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
20390         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
20391         witness_ref.data_is_owned = true;
20392         LDKCVec_u8Z script_sig_ref;
20393         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
20394         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
20395         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
20396         LDKThirtyTwoBytes previous_txid_ref;
20397         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
20398         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
20399         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
20400         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
20401         return tag_ptr(ret_ref, true);
20402 }
20403
20404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
20405         LDKCVec_u8Z script_pubkey_ref;
20406         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
20407         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
20408         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
20409         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20410         *ret_ref = TxOut_new(script_pubkey_ref, value);
20411         return tag_ptr(ret_ref, true);
20412 }
20413
20414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
20415         if (!ptr_is_owned(_res)) return;
20416         void* _res_ptr = untag_ptr(_res);
20417         CHECK_ACCESS(_res_ptr);
20418         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
20419         FREE(untag_ptr(_res));
20420         TxOut_free(_res_conv);
20421 }
20422
20423 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
20424         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20425         *ret_ref = TxOut_clone(arg);
20426         return tag_ptr(ret_ref, true);
20427 }
20428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20429         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
20430         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
20431         return ret_conv;
20432 }
20433
20434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20435         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
20436         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20437         *ret_ref = TxOut_clone(orig_conv);
20438         return tag_ptr(ret_ref, true);
20439 }
20440
20441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
20442         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
20443         Str_free(dummy);
20444 }
20445
20446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
20447         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20448         *ret_copy = COption_u64Z_some(o);
20449         int64_t ret_ref = tag_ptr(ret_copy, true);
20450         return ret_ref;
20451 }
20452
20453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
20454         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20455         *ret_copy = COption_u64Z_none();
20456         int64_t ret_ref = tag_ptr(ret_copy, true);
20457         return ret_ref;
20458 }
20459
20460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
20461         if (!ptr_is_owned(_res)) return;
20462         void* _res_ptr = untag_ptr(_res);
20463         CHECK_ACCESS(_res_ptr);
20464         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
20465         FREE(untag_ptr(_res));
20466         COption_u64Z_free(_res_conv);
20467 }
20468
20469 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
20470         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20471         *ret_copy = COption_u64Z_clone(arg);
20472         int64_t ret_ref = tag_ptr(ret_copy, true);
20473         return ret_ref;
20474 }
20475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20476         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
20477         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
20478         return ret_conv;
20479 }
20480
20481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20482         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
20483         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20484         *ret_copy = COption_u64Z_clone(orig_conv);
20485         int64_t ret_ref = tag_ptr(ret_copy, true);
20486         return ret_ref;
20487 }
20488
20489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20490         LDKCVec_BlindedPathZ _res_constr;
20491         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20492         if (_res_constr.datalen > 0)
20493                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
20494         else
20495                 _res_constr.data = NULL;
20496         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20497         for (size_t n = 0; n < _res_constr.datalen; n++) {
20498                 int64_t _res_conv_13 = _res_vals[n];
20499                 LDKBlindedPath _res_conv_13_conv;
20500                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
20501                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
20502                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
20503                 _res_constr.data[n] = _res_conv_13_conv;
20504         }
20505         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20506         CVec_BlindedPathZ_free(_res_constr);
20507 }
20508
20509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20510         LDKRefund o_conv;
20511         o_conv.inner = untag_ptr(o);
20512         o_conv.is_owned = ptr_is_owned(o);
20513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20514         o_conv = Refund_clone(&o_conv);
20515         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20516         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
20517         return tag_ptr(ret_conv, true);
20518 }
20519
20520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20521         LDKBolt12ParseError e_conv;
20522         e_conv.inner = untag_ptr(e);
20523         e_conv.is_owned = ptr_is_owned(e);
20524         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20525         e_conv = Bolt12ParseError_clone(&e_conv);
20526         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20527         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
20528         return tag_ptr(ret_conv, true);
20529 }
20530
20531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20532         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
20533         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
20534         return ret_conv;
20535 }
20536
20537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20538         if (!ptr_is_owned(_res)) return;
20539         void* _res_ptr = untag_ptr(_res);
20540         CHECK_ACCESS(_res_ptr);
20541         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
20542         FREE(untag_ptr(_res));
20543         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
20544 }
20545
20546 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
20547         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20548         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
20549         return tag_ptr(ret_conv, true);
20550 }
20551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20552         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
20553         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
20554         return ret_conv;
20555 }
20556
20557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20558         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
20559         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20560         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
20561         return tag_ptr(ret_conv, true);
20562 }
20563
20564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20565         void* o_ptr = untag_ptr(o);
20566         CHECK_ACCESS(o_ptr);
20567         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
20568         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
20569         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20570         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
20571         return tag_ptr(ret_conv, true);
20572 }
20573
20574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20575         void* e_ptr = untag_ptr(e);
20576         CHECK_ACCESS(e_ptr);
20577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20579         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20580         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
20581         return tag_ptr(ret_conv, true);
20582 }
20583
20584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20585         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
20586         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
20587         return ret_conv;
20588 }
20589
20590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20591         if (!ptr_is_owned(_res)) return;
20592         void* _res_ptr = untag_ptr(_res);
20593         CHECK_ACCESS(_res_ptr);
20594         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
20595         FREE(untag_ptr(_res));
20596         CResult_RetryDecodeErrorZ_free(_res_conv);
20597 }
20598
20599 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
20600         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20601         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
20602         return tag_ptr(ret_conv, true);
20603 }
20604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20605         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
20606         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
20607         return ret_conv;
20608 }
20609
20610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20611         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
20612         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20613         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
20614         return tag_ptr(ret_conv, true);
20615 }
20616
20617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
20618         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20619         *ret_conv = CResult_NoneAPIErrorZ_ok();
20620         return tag_ptr(ret_conv, true);
20621 }
20622
20623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20624         void* e_ptr = untag_ptr(e);
20625         CHECK_ACCESS(e_ptr);
20626         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20627         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20628         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20629         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
20630         return tag_ptr(ret_conv, true);
20631 }
20632
20633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20634         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
20635         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
20636         return ret_conv;
20637 }
20638
20639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20640         if (!ptr_is_owned(_res)) return;
20641         void* _res_ptr = untag_ptr(_res);
20642         CHECK_ACCESS(_res_ptr);
20643         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
20644         FREE(untag_ptr(_res));
20645         CResult_NoneAPIErrorZ_free(_res_conv);
20646 }
20647
20648 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
20649         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20650         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
20651         return tag_ptr(ret_conv, true);
20652 }
20653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20654         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
20655         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
20656         return ret_conv;
20657 }
20658
20659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20660         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
20661         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20662         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
20663         return tag_ptr(ret_conv, true);
20664 }
20665
20666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20667         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
20668         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20669         if (_res_constr.datalen > 0)
20670                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
20671         else
20672                 _res_constr.data = NULL;
20673         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20674         for (size_t w = 0; w < _res_constr.datalen; w++) {
20675                 int64_t _res_conv_22 = _res_vals[w];
20676                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20677                 CHECK_ACCESS(_res_conv_22_ptr);
20678                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
20679                 FREE(untag_ptr(_res_conv_22));
20680                 _res_constr.data[w] = _res_conv_22_conv;
20681         }
20682         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20683         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
20684 }
20685
20686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20687         LDKCVec_APIErrorZ _res_constr;
20688         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20689         if (_res_constr.datalen > 0)
20690                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
20691         else
20692                 _res_constr.data = NULL;
20693         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20694         for (size_t k = 0; k < _res_constr.datalen; k++) {
20695                 int64_t _res_conv_10 = _res_vals[k];
20696                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
20697                 CHECK_ACCESS(_res_conv_10_ptr);
20698                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
20699                 FREE(untag_ptr(_res_conv_10));
20700                 _res_constr.data[k] = _res_conv_10_conv;
20701         }
20702         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20703         CVec_APIErrorZ_free(_res_constr);
20704 }
20705
20706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
20707         LDKThirtyTwoBytes o_ref;
20708         CHECK((*env)->GetArrayLength(env, o) == 32);
20709         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20710         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
20711         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
20712         int64_t ret_ref = tag_ptr(ret_copy, true);
20713         return ret_ref;
20714 }
20715
20716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1none(JNIEnv *env, jclass clz) {
20717         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
20718         *ret_copy = COption_ThirtyTwoBytesZ_none();
20719         int64_t ret_ref = tag_ptr(ret_copy, true);
20720         return ret_ref;
20721 }
20722
20723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20724         if (!ptr_is_owned(_res)) return;
20725         void* _res_ptr = untag_ptr(_res);
20726         CHECK_ACCESS(_res_ptr);
20727         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
20728         FREE(untag_ptr(_res));
20729         COption_ThirtyTwoBytesZ_free(_res_conv);
20730 }
20731
20732 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
20733         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
20734         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
20735         int64_t ret_ref = tag_ptr(ret_copy, true);
20736         return ret_ref;
20737 }
20738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20739         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
20740         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
20741         return ret_conv;
20742 }
20743
20744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20745         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
20746         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
20747         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
20748         int64_t ret_ref = tag_ptr(ret_copy, true);
20749         return ret_ref;
20750 }
20751
20752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20753         LDKCVec_u8Z _res_ref;
20754         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20755         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
20756         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20757         CVec_u8Z_free(_res_ref);
20758 }
20759
20760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
20761         LDKCVec_u8Z o_ref;
20762         o_ref.datalen = (*env)->GetArrayLength(env, o);
20763         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20764         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20765         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
20766         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
20767         int64_t ret_ref = tag_ptr(ret_copy, true);
20768         return ret_ref;
20769 }
20770
20771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
20772         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
20773         *ret_copy = COption_CVec_u8ZZ_none();
20774         int64_t ret_ref = tag_ptr(ret_copy, true);
20775         return ret_ref;
20776 }
20777
20778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20779         if (!ptr_is_owned(_res)) return;
20780         void* _res_ptr = untag_ptr(_res);
20781         CHECK_ACCESS(_res_ptr);
20782         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
20783         FREE(untag_ptr(_res));
20784         COption_CVec_u8ZZ_free(_res_conv);
20785 }
20786
20787 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
20788         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
20789         *ret_copy = COption_CVec_u8ZZ_clone(arg);
20790         int64_t ret_ref = tag_ptr(ret_copy, true);
20791         return ret_ref;
20792 }
20793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20794         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
20795         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
20796         return ret_conv;
20797 }
20798
20799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20800         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
20801         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
20802         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
20803         int64_t ret_ref = tag_ptr(ret_copy, true);
20804         return ret_ref;
20805 }
20806
20807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20808         LDKRecipientOnionFields o_conv;
20809         o_conv.inner = untag_ptr(o);
20810         o_conv.is_owned = ptr_is_owned(o);
20811         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20812         o_conv = RecipientOnionFields_clone(&o_conv);
20813         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
20814         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
20815         return tag_ptr(ret_conv, true);
20816 }
20817
20818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20819         void* e_ptr = untag_ptr(e);
20820         CHECK_ACCESS(e_ptr);
20821         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20822         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20823         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
20824         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
20825         return tag_ptr(ret_conv, true);
20826 }
20827
20828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20829         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
20830         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
20831         return ret_conv;
20832 }
20833
20834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20835         if (!ptr_is_owned(_res)) return;
20836         void* _res_ptr = untag_ptr(_res);
20837         CHECK_ACCESS(_res_ptr);
20838         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
20839         FREE(untag_ptr(_res));
20840         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
20841 }
20842
20843 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
20844         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
20845         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
20846         return tag_ptr(ret_conv, true);
20847 }
20848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20849         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
20850         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
20851         return ret_conv;
20852 }
20853
20854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20855         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
20856         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
20857         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
20858         return tag_ptr(ret_conv, true);
20859 }
20860
20861 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
20862         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
20863         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
20864         return tag_ptr(ret_conv, true);
20865 }
20866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20867         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
20868         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
20869         return ret_conv;
20870 }
20871
20872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20873         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
20874         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
20875         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
20876         return tag_ptr(ret_conv, true);
20877 }
20878
20879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
20880         LDKCVec_u8Z b_ref;
20881         b_ref.datalen = (*env)->GetArrayLength(env, b);
20882         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20883         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20884         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
20885         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
20886         return tag_ptr(ret_conv, true);
20887 }
20888
20889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20890         if (!ptr_is_owned(_res)) return;
20891         void* _res_ptr = untag_ptr(_res);
20892         CHECK_ACCESS(_res_ptr);
20893         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
20894         FREE(untag_ptr(_res));
20895         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
20896 }
20897
20898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u64CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20899         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
20900         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20901         if (_res_constr.datalen > 0)
20902                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
20903         else
20904                 _res_constr.data = NULL;
20905         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20906         for (size_t x = 0; x < _res_constr.datalen; x++) {
20907                 int64_t _res_conv_23 = _res_vals[x];
20908                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
20909                 CHECK_ACCESS(_res_conv_23_ptr);
20910                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
20911                 FREE(untag_ptr(_res_conv_23));
20912                 _res_constr.data[x] = _res_conv_23_conv;
20913         }
20914         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20915         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
20916 }
20917
20918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20919         LDKRecipientOnionFields o_conv;
20920         o_conv.inner = untag_ptr(o);
20921         o_conv.is_owned = ptr_is_owned(o);
20922         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20923         o_conv = RecipientOnionFields_clone(&o_conv);
20924         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
20925         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
20926         return tag_ptr(ret_conv, true);
20927 }
20928
20929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1err(JNIEnv *env, jclass clz) {
20930         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
20931         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
20932         return tag_ptr(ret_conv, true);
20933 }
20934
20935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20936         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
20937         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
20938         return ret_conv;
20939 }
20940
20941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20942         if (!ptr_is_owned(_res)) return;
20943         void* _res_ptr = untag_ptr(_res);
20944         CHECK_ACCESS(_res_ptr);
20945         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
20946         FREE(untag_ptr(_res));
20947         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
20948 }
20949
20950 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
20951         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
20952         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
20953         return tag_ptr(ret_conv, true);
20954 }
20955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20956         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
20957         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
20958         return ret_conv;
20959 }
20960
20961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20962         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
20963         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
20964         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
20965         return tag_ptr(ret_conv, true);
20966 }
20967
20968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20969         LDKCVec_ThirtyTwoBytesZ _res_constr;
20970         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20971         if (_res_constr.datalen > 0)
20972                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
20973         else
20974                 _res_constr.data = NULL;
20975         for (size_t i = 0; i < _res_constr.datalen; i++) {
20976                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20977                 LDKThirtyTwoBytes _res_conv_8_ref;
20978                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
20979                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
20980                 _res_constr.data[i] = _res_conv_8_ref;
20981         }
20982         CVec_ThirtyTwoBytesZ_free(_res_constr);
20983 }
20984
20985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
20986         LDKCVec_ThirtyTwoBytesZ o_constr;
20987         o_constr.datalen = (*env)->GetArrayLength(env, o);
20988         if (o_constr.datalen > 0)
20989                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
20990         else
20991                 o_constr.data = NULL;
20992         for (size_t i = 0; i < o_constr.datalen; i++) {
20993                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
20994                 LDKThirtyTwoBytes o_conv_8_ref;
20995                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
20996                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
20997                 o_constr.data[i] = o_conv_8_ref;
20998         }
20999         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21000         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
21001         int64_t ret_ref = tag_ptr(ret_copy, true);
21002         return ret_ref;
21003 }
21004
21005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1none(JNIEnv *env, jclass clz) {
21006         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21007         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
21008         int64_t ret_ref = tag_ptr(ret_copy, true);
21009         return ret_ref;
21010 }
21011
21012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21013         if (!ptr_is_owned(_res)) return;
21014         void* _res_ptr = untag_ptr(_res);
21015         CHECK_ACCESS(_res_ptr);
21016         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
21017         FREE(untag_ptr(_res));
21018         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
21019 }
21020
21021 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
21022         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21023         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
21024         int64_t ret_ref = tag_ptr(ret_copy, true);
21025         return ret_ref;
21026 }
21027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21028         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
21029         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
21030         return ret_conv;
21031 }
21032
21033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21034         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
21035         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21036         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
21037         int64_t ret_ref = tag_ptr(ret_copy, true);
21038         return ret_ref;
21039 }
21040
21041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21042         LDKThirtyTwoBytes o_ref;
21043         CHECK((*env)->GetArrayLength(env, o) == 32);
21044         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21045         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21046         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
21047         return tag_ptr(ret_conv, true);
21048 }
21049
21050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1err(JNIEnv *env, jclass clz) {
21051         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21052         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
21053         return tag_ptr(ret_conv, true);
21054 }
21055
21056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21057         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
21058         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
21059         return ret_conv;
21060 }
21061
21062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21063         if (!ptr_is_owned(_res)) return;
21064         void* _res_ptr = untag_ptr(_res);
21065         CHECK_ACCESS(_res_ptr);
21066         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
21067         FREE(untag_ptr(_res));
21068         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
21069 }
21070
21071 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
21072         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21073         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
21074         return tag_ptr(ret_conv, true);
21075 }
21076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21077         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
21078         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
21079         return ret_conv;
21080 }
21081
21082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21083         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
21084         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21085         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
21086         return tag_ptr(ret_conv, true);
21087 }
21088
21089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21090         LDKBlindedPayInfo o_conv;
21091         o_conv.inner = untag_ptr(o);
21092         o_conv.is_owned = ptr_is_owned(o);
21093         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21094         o_conv = BlindedPayInfo_clone(&o_conv);
21095         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21096         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
21097         return tag_ptr(ret_conv, true);
21098 }
21099
21100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21101         void* e_ptr = untag_ptr(e);
21102         CHECK_ACCESS(e_ptr);
21103         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21104         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21105         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21106         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
21107         return tag_ptr(ret_conv, true);
21108 }
21109
21110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21111         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
21112         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
21113         return ret_conv;
21114 }
21115
21116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21117         if (!ptr_is_owned(_res)) return;
21118         void* _res_ptr = untag_ptr(_res);
21119         CHECK_ACCESS(_res_ptr);
21120         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
21121         FREE(untag_ptr(_res));
21122         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
21123 }
21124
21125 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
21126         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21127         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
21128         return tag_ptr(ret_conv, true);
21129 }
21130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21131         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
21132         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
21133         return ret_conv;
21134 }
21135
21136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21137         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
21138         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21139         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
21140         return tag_ptr(ret_conv, true);
21141 }
21142
21143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21144         LDKDelayedPaymentOutputDescriptor o_conv;
21145         o_conv.inner = untag_ptr(o);
21146         o_conv.is_owned = ptr_is_owned(o);
21147         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21148         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
21149         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21150         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
21151         return tag_ptr(ret_conv, true);
21152 }
21153
21154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21155         void* e_ptr = untag_ptr(e);
21156         CHECK_ACCESS(e_ptr);
21157         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21158         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21159         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21160         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
21161         return tag_ptr(ret_conv, true);
21162 }
21163
21164 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21165         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21166         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21167         return ret_conv;
21168 }
21169
21170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21171         if (!ptr_is_owned(_res)) return;
21172         void* _res_ptr = untag_ptr(_res);
21173         CHECK_ACCESS(_res_ptr);
21174         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
21175         FREE(untag_ptr(_res));
21176         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
21177 }
21178
21179 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21180         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21181         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
21182         return tag_ptr(ret_conv, true);
21183 }
21184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21185         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21186         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21187         return ret_conv;
21188 }
21189
21190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21191         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21192         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21193         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
21194         return tag_ptr(ret_conv, true);
21195 }
21196
21197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21198         LDKStaticPaymentOutputDescriptor o_conv;
21199         o_conv.inner = untag_ptr(o);
21200         o_conv.is_owned = ptr_is_owned(o);
21201         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21202         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
21203         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21204         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
21205         return tag_ptr(ret_conv, true);
21206 }
21207
21208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21209         void* e_ptr = untag_ptr(e);
21210         CHECK_ACCESS(e_ptr);
21211         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21212         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21213         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21214         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
21215         return tag_ptr(ret_conv, true);
21216 }
21217
21218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21219         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21220         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21221         return ret_conv;
21222 }
21223
21224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21225         if (!ptr_is_owned(_res)) return;
21226         void* _res_ptr = untag_ptr(_res);
21227         CHECK_ACCESS(_res_ptr);
21228         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
21229         FREE(untag_ptr(_res));
21230         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
21231 }
21232
21233 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21234         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21235         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
21236         return tag_ptr(ret_conv, true);
21237 }
21238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21239         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21240         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21241         return ret_conv;
21242 }
21243
21244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21245         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21246         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21247         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
21248         return tag_ptr(ret_conv, true);
21249 }
21250
21251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21252         void* o_ptr = untag_ptr(o);
21253         CHECK_ACCESS(o_ptr);
21254         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
21255         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
21256         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21257         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
21258         return tag_ptr(ret_conv, true);
21259 }
21260
21261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21262         void* e_ptr = untag_ptr(e);
21263         CHECK_ACCESS(e_ptr);
21264         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21265         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21266         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21267         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
21268         return tag_ptr(ret_conv, true);
21269 }
21270
21271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21272         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21273         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21274         return ret_conv;
21275 }
21276
21277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21278         if (!ptr_is_owned(_res)) return;
21279         void* _res_ptr = untag_ptr(_res);
21280         CHECK_ACCESS(_res_ptr);
21281         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
21282         FREE(untag_ptr(_res));
21283         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
21284 }
21285
21286 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21287         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21288         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
21289         return tag_ptr(ret_conv, true);
21290 }
21291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21292         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21293         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21294         return ret_conv;
21295 }
21296
21297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21298         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21299         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21300         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
21301         return tag_ptr(ret_conv, true);
21302 }
21303
21304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21305         LDKCVec_SpendableOutputDescriptorZ _res_constr;
21306         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21307         if (_res_constr.datalen > 0)
21308                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21309         else
21310                 _res_constr.data = NULL;
21311         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21312         for (size_t b = 0; b < _res_constr.datalen; b++) {
21313                 int64_t _res_conv_27 = _res_vals[b];
21314                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
21315                 CHECK_ACCESS(_res_conv_27_ptr);
21316                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
21317                 FREE(untag_ptr(_res_conv_27));
21318                 _res_constr.data[b] = _res_conv_27_conv;
21319         }
21320         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21321         CVec_SpendableOutputDescriptorZ_free(_res_constr);
21322 }
21323
21324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21325         LDKCVec_TxOutZ _res_constr;
21326         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21327         if (_res_constr.datalen > 0)
21328                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
21329         else
21330                 _res_constr.data = NULL;
21331         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21332         for (size_t h = 0; h < _res_constr.datalen; h++) {
21333                 int64_t _res_conv_7 = _res_vals[h];
21334                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
21335                 CHECK_ACCESS(_res_conv_7_ptr);
21336                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
21337                 FREE(untag_ptr(_res_conv_7));
21338                 _res_constr.data[h] = _res_conv_7_conv;
21339         }
21340         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21341         CVec_TxOutZ_free(_res_constr);
21342 }
21343
21344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
21345         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21346         *ret_copy = COption_u32Z_some(o);
21347         int64_t ret_ref = tag_ptr(ret_copy, true);
21348         return ret_ref;
21349 }
21350
21351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
21352         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21353         *ret_copy = COption_u32Z_none();
21354         int64_t ret_ref = tag_ptr(ret_copy, true);
21355         return ret_ref;
21356 }
21357
21358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21359         if (!ptr_is_owned(_res)) return;
21360         void* _res_ptr = untag_ptr(_res);
21361         CHECK_ACCESS(_res_ptr);
21362         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
21363         FREE(untag_ptr(_res));
21364         COption_u32Z_free(_res_conv);
21365 }
21366
21367 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
21368         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21369         *ret_copy = COption_u32Z_clone(arg);
21370         int64_t ret_ref = tag_ptr(ret_copy, true);
21371         return ret_ref;
21372 }
21373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21374         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
21375         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
21376         return ret_conv;
21377 }
21378
21379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21380         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
21381         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21382         *ret_copy = COption_u32Z_clone(orig_conv);
21383         int64_t ret_ref = tag_ptr(ret_copy, true);
21384         return ret_ref;
21385 }
21386
21387 static inline uint64_t C2Tuple_CVec_u8ZusizeZ_clone_ptr(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR arg) {
21388         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21389         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(arg);
21390         return tag_ptr(ret_conv, true);
21391 }
21392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21393         LDKC2Tuple_CVec_u8ZusizeZ* arg_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(arg);
21394         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_clone_ptr(arg_conv);
21395         return ret_conv;
21396 }
21397
21398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21399         LDKC2Tuple_CVec_u8ZusizeZ* orig_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(orig);
21400         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21401         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(orig_conv);
21402         return tag_ptr(ret_conv, true);
21403 }
21404
21405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
21406         LDKCVec_u8Z a_ref;
21407         a_ref.datalen = (*env)->GetArrayLength(env, a);
21408         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
21409         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
21410         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21411         *ret_conv = C2Tuple_CVec_u8ZusizeZ_new(a_ref, b);
21412         return tag_ptr(ret_conv, true);
21413 }
21414
21415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21416         if (!ptr_is_owned(_res)) return;
21417         void* _res_ptr = untag_ptr(_res);
21418         CHECK_ACCESS(_res_ptr);
21419         LDKC2Tuple_CVec_u8ZusizeZ _res_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(_res_ptr);
21420         FREE(untag_ptr(_res));
21421         C2Tuple_CVec_u8ZusizeZ_free(_res_conv);
21422 }
21423
21424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21425         void* o_ptr = untag_ptr(o);
21426         CHECK_ACCESS(o_ptr);
21427         LDKC2Tuple_CVec_u8ZusizeZ o_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(o_ptr);
21428         o_conv = C2Tuple_CVec_u8ZusizeZ_clone((LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(o));
21429         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21430         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o_conv);
21431         return tag_ptr(ret_conv, true);
21432 }
21433
21434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1err(JNIEnv *env, jclass clz) {
21435         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21436         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err();
21437         return tag_ptr(ret_conv, true);
21438 }
21439
21440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21441         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(o);
21442         jboolean ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o_conv);
21443         return ret_conv;
21444 }
21445
21446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21447         if (!ptr_is_owned(_res)) return;
21448         void* _res_ptr = untag_ptr(_res);
21449         CHECK_ACCESS(_res_ptr);
21450         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)(_res_ptr);
21451         FREE(untag_ptr(_res));
21452         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res_conv);
21453 }
21454
21455 static inline uint64_t CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR arg) {
21456         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21457         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(arg);
21458         return tag_ptr(ret_conv, true);
21459 }
21460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21461         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(arg);
21462         int64_t ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(arg_conv);
21463         return ret_conv;
21464 }
21465
21466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21467         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(orig);
21468         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21469         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig_conv);
21470         return tag_ptr(ret_conv, true);
21471 }
21472
21473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
21474         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21475         *ret_conv = CResult_NoneNoneZ_ok();
21476         return tag_ptr(ret_conv, true);
21477 }
21478
21479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
21480         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21481         *ret_conv = CResult_NoneNoneZ_err();
21482         return tag_ptr(ret_conv, true);
21483 }
21484
21485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21486         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
21487         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
21488         return ret_conv;
21489 }
21490
21491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21492         if (!ptr_is_owned(_res)) return;
21493         void* _res_ptr = untag_ptr(_res);
21494         CHECK_ACCESS(_res_ptr);
21495         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
21496         FREE(untag_ptr(_res));
21497         CResult_NoneNoneZ_free(_res_conv);
21498 }
21499
21500 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
21501         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21502         *ret_conv = CResult_NoneNoneZ_clone(arg);
21503         return tag_ptr(ret_conv, true);
21504 }
21505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21506         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
21507         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
21508         return ret_conv;
21509 }
21510
21511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21512         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
21513         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21514         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
21515         return tag_ptr(ret_conv, true);
21516 }
21517
21518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21519         LDKCVec_ECDSASignatureZ _res_constr;
21520         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21521         if (_res_constr.datalen > 0)
21522                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
21523         else
21524                 _res_constr.data = NULL;
21525         for (size_t i = 0; i < _res_constr.datalen; i++) {
21526                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21527                 LDKECDSASignature _res_conv_8_ref;
21528                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
21529                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
21530                 _res_constr.data[i] = _res_conv_8_ref;
21531         }
21532         CVec_ECDSASignatureZ_free(_res_constr);
21533 }
21534
21535 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
21536         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21537         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
21538         return tag_ptr(ret_conv, true);
21539 }
21540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21541         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
21542         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
21543         return ret_conv;
21544 }
21545
21546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21547         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
21548         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21549         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
21550         return tag_ptr(ret_conv, true);
21551 }
21552
21553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
21554         LDKECDSASignature a_ref;
21555         CHECK((*env)->GetArrayLength(env, a) == 64);
21556         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
21557         LDKCVec_ECDSASignatureZ b_constr;
21558         b_constr.datalen = (*env)->GetArrayLength(env, b);
21559         if (b_constr.datalen > 0)
21560                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
21561         else
21562                 b_constr.data = NULL;
21563         for (size_t i = 0; i < b_constr.datalen; i++) {
21564                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
21565                 LDKECDSASignature b_conv_8_ref;
21566                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
21567                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
21568                 b_constr.data[i] = b_conv_8_ref;
21569         }
21570         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21571         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
21572         return tag_ptr(ret_conv, true);
21573 }
21574
21575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21576         if (!ptr_is_owned(_res)) return;
21577         void* _res_ptr = untag_ptr(_res);
21578         CHECK_ACCESS(_res_ptr);
21579         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
21580         FREE(untag_ptr(_res));
21581         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
21582 }
21583
21584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21585         void* o_ptr = untag_ptr(o);
21586         CHECK_ACCESS(o_ptr);
21587         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
21588         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
21589         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21590         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
21591         return tag_ptr(ret_conv, true);
21592 }
21593
21594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
21595         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21596         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
21597         return tag_ptr(ret_conv, true);
21598 }
21599
21600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21601         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
21602         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
21603         return ret_conv;
21604 }
21605
21606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21607         if (!ptr_is_owned(_res)) return;
21608         void* _res_ptr = untag_ptr(_res);
21609         CHECK_ACCESS(_res_ptr);
21610         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
21611         FREE(untag_ptr(_res));
21612         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
21613 }
21614
21615 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
21616         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21617         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
21618         return tag_ptr(ret_conv, true);
21619 }
21620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21621         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
21622         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
21623         return ret_conv;
21624 }
21625
21626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21627         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
21628         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21629         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
21630         return tag_ptr(ret_conv, true);
21631 }
21632
21633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21634         LDKECDSASignature o_ref;
21635         CHECK((*env)->GetArrayLength(env, o) == 64);
21636         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
21637         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
21638         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
21639         return tag_ptr(ret_conv, true);
21640 }
21641
21642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1err(JNIEnv *env, jclass clz) {
21643         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
21644         *ret_conv = CResult_ECDSASignatureNoneZ_err();
21645         return tag_ptr(ret_conv, true);
21646 }
21647
21648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21649         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
21650         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
21651         return ret_conv;
21652 }
21653
21654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21655         if (!ptr_is_owned(_res)) return;
21656         void* _res_ptr = untag_ptr(_res);
21657         CHECK_ACCESS(_res_ptr);
21658         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
21659         FREE(untag_ptr(_res));
21660         CResult_ECDSASignatureNoneZ_free(_res_conv);
21661 }
21662
21663 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
21664         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
21665         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
21666         return tag_ptr(ret_conv, true);
21667 }
21668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21669         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
21670         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
21671         return ret_conv;
21672 }
21673
21674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21675         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
21676         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
21677         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
21678         return tag_ptr(ret_conv, true);
21679 }
21680
21681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21682         LDKPublicKey o_ref;
21683         CHECK((*env)->GetArrayLength(env, o) == 33);
21684         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
21685         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
21686         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
21687         return tag_ptr(ret_conv, true);
21688 }
21689
21690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
21691         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
21692         *ret_conv = CResult_PublicKeyNoneZ_err();
21693         return tag_ptr(ret_conv, true);
21694 }
21695
21696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21697         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
21698         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
21699         return ret_conv;
21700 }
21701
21702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21703         if (!ptr_is_owned(_res)) return;
21704         void* _res_ptr = untag_ptr(_res);
21705         CHECK_ACCESS(_res_ptr);
21706         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
21707         FREE(untag_ptr(_res));
21708         CResult_PublicKeyNoneZ_free(_res_conv);
21709 }
21710
21711 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
21712         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
21713         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
21714         return tag_ptr(ret_conv, true);
21715 }
21716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21717         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
21718         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
21719         return ret_conv;
21720 }
21721
21722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21723         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
21724         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
21725         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
21726         return tag_ptr(ret_conv, true);
21727 }
21728
21729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21730         void* o_ptr = untag_ptr(o);
21731         CHECK_ACCESS(o_ptr);
21732         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
21733         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
21734         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
21735         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
21736         int64_t ret_ref = tag_ptr(ret_copy, true);
21737         return ret_ref;
21738 }
21739
21740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1none(JNIEnv *env, jclass clz) {
21741         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
21742         *ret_copy = COption_BigEndianScalarZ_none();
21743         int64_t ret_ref = tag_ptr(ret_copy, true);
21744         return ret_ref;
21745 }
21746
21747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21748         if (!ptr_is_owned(_res)) return;
21749         void* _res_ptr = untag_ptr(_res);
21750         CHECK_ACCESS(_res_ptr);
21751         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
21752         FREE(untag_ptr(_res));
21753         COption_BigEndianScalarZ_free(_res_conv);
21754 }
21755
21756 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
21757         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
21758         *ret_copy = COption_BigEndianScalarZ_clone(arg);
21759         int64_t ret_ref = tag_ptr(ret_copy, true);
21760         return ret_ref;
21761 }
21762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21763         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
21764         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
21765         return ret_conv;
21766 }
21767
21768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21769         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
21770         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
21771         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
21772         int64_t ret_ref = tag_ptr(ret_copy, true);
21773         return ret_ref;
21774 }
21775
21776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21777         LDKCVec_U5Z _res_constr;
21778         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21779         if (_res_constr.datalen > 0)
21780                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
21781         else
21782                 _res_constr.data = NULL;
21783         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
21784         for (size_t h = 0; h < _res_constr.datalen; h++) {
21785                 int8_t _res_conv_7 = _res_vals[h];
21786                 
21787                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
21788         }
21789         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
21790         CVec_U5Z_free(_res_constr);
21791 }
21792
21793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21794         LDKRecoverableSignature o_ref;
21795         CHECK((*env)->GetArrayLength(env, o) == 68);
21796         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
21797         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
21798         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
21799         return tag_ptr(ret_conv, true);
21800 }
21801
21802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
21803         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
21804         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
21805         return tag_ptr(ret_conv, true);
21806 }
21807
21808 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21809         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
21810         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
21811         return ret_conv;
21812 }
21813
21814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21815         if (!ptr_is_owned(_res)) return;
21816         void* _res_ptr = untag_ptr(_res);
21817         CHECK_ACCESS(_res_ptr);
21818         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
21819         FREE(untag_ptr(_res));
21820         CResult_RecoverableSignatureNoneZ_free(_res_conv);
21821 }
21822
21823 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
21824         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
21825         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
21826         return tag_ptr(ret_conv, true);
21827 }
21828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21829         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
21830         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
21831         return ret_conv;
21832 }
21833
21834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21835         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
21836         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
21837         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
21838         return tag_ptr(ret_conv, true);
21839 }
21840
21841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21842         LDKSchnorrSignature o_ref;
21843         CHECK((*env)->GetArrayLength(env, o) == 64);
21844         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
21845         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
21846         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
21847         return tag_ptr(ret_conv, true);
21848 }
21849
21850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
21851         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
21852         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
21853         return tag_ptr(ret_conv, true);
21854 }
21855
21856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21857         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
21858         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
21859         return ret_conv;
21860 }
21861
21862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21863         if (!ptr_is_owned(_res)) return;
21864         void* _res_ptr = untag_ptr(_res);
21865         CHECK_ACCESS(_res_ptr);
21866         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
21867         FREE(untag_ptr(_res));
21868         CResult_SchnorrSignatureNoneZ_free(_res_conv);
21869 }
21870
21871 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
21872         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
21873         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
21874         return tag_ptr(ret_conv, true);
21875 }
21876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21877         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
21878         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
21879         return ret_conv;
21880 }
21881
21882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21883         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
21884         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
21885         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
21886         return tag_ptr(ret_conv, true);
21887 }
21888
21889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21890         void* o_ptr = untag_ptr(o);
21891         CHECK_ACCESS(o_ptr);
21892         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
21893         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
21894                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21895                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
21896         }
21897         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
21898         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
21899         return tag_ptr(ret_conv, true);
21900 }
21901
21902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21903         void* e_ptr = untag_ptr(e);
21904         CHECK_ACCESS(e_ptr);
21905         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21906         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21907         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
21908         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
21909         return tag_ptr(ret_conv, true);
21910 }
21911
21912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21913         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
21914         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
21915         return ret_conv;
21916 }
21917
21918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21919         if (!ptr_is_owned(_res)) return;
21920         void* _res_ptr = untag_ptr(_res);
21921         CHECK_ACCESS(_res_ptr);
21922         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
21923         FREE(untag_ptr(_res));
21924         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
21925 }
21926
21927 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
21928         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
21929         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
21930         return tag_ptr(ret_conv, true);
21931 }
21932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21933         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
21934         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
21935         return ret_conv;
21936 }
21937
21938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21939         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
21940         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
21941         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
21942         return tag_ptr(ret_conv, true);
21943 }
21944
21945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21946         LDKCVec_u8Z o_ref;
21947         o_ref.datalen = (*env)->GetArrayLength(env, o);
21948         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
21949         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
21950         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21951         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
21952         return tag_ptr(ret_conv, true);
21953 }
21954
21955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1err(JNIEnv *env, jclass clz) {
21956         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21957         *ret_conv = CResult_CVec_u8ZNoneZ_err();
21958         return tag_ptr(ret_conv, true);
21959 }
21960
21961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21962         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
21963         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
21964         return ret_conv;
21965 }
21966
21967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21968         if (!ptr_is_owned(_res)) return;
21969         void* _res_ptr = untag_ptr(_res);
21970         CHECK_ACCESS(_res_ptr);
21971         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
21972         FREE(untag_ptr(_res));
21973         CResult_CVec_u8ZNoneZ_free(_res_conv);
21974 }
21975
21976 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
21977         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21978         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
21979         return tag_ptr(ret_conv, true);
21980 }
21981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21982         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
21983         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
21984         return ret_conv;
21985 }
21986
21987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21988         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
21989         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21990         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
21991         return tag_ptr(ret_conv, true);
21992 }
21993
21994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21995         LDKShutdownScript o_conv;
21996         o_conv.inner = untag_ptr(o);
21997         o_conv.is_owned = ptr_is_owned(o);
21998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21999         o_conv = ShutdownScript_clone(&o_conv);
22000         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22001         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
22002         return tag_ptr(ret_conv, true);
22003 }
22004
22005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
22006         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22007         *ret_conv = CResult_ShutdownScriptNoneZ_err();
22008         return tag_ptr(ret_conv, true);
22009 }
22010
22011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22012         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
22013         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
22014         return ret_conv;
22015 }
22016
22017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22018         if (!ptr_is_owned(_res)) return;
22019         void* _res_ptr = untag_ptr(_res);
22020         CHECK_ACCESS(_res_ptr);
22021         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
22022         FREE(untag_ptr(_res));
22023         CResult_ShutdownScriptNoneZ_free(_res_conv);
22024 }
22025
22026 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
22027         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22028         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
22029         return tag_ptr(ret_conv, true);
22030 }
22031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22032         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
22033         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
22034         return ret_conv;
22035 }
22036
22037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22038         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
22039         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22040         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
22041         return tag_ptr(ret_conv, true);
22042 }
22043
22044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
22045         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22046         *ret_copy = COption_u16Z_some(o);
22047         int64_t ret_ref = tag_ptr(ret_copy, true);
22048         return ret_ref;
22049 }
22050
22051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
22052         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22053         *ret_copy = COption_u16Z_none();
22054         int64_t ret_ref = tag_ptr(ret_copy, true);
22055         return ret_ref;
22056 }
22057
22058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
22059         if (!ptr_is_owned(_res)) return;
22060         void* _res_ptr = untag_ptr(_res);
22061         CHECK_ACCESS(_res_ptr);
22062         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
22063         FREE(untag_ptr(_res));
22064         COption_u16Z_free(_res_conv);
22065 }
22066
22067 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
22068         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22069         *ret_copy = COption_u16Z_clone(arg);
22070         int64_t ret_ref = tag_ptr(ret_copy, true);
22071         return ret_ref;
22072 }
22073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22074         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
22075         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
22076         return ret_conv;
22077 }
22078
22079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22080         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
22081         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22082         *ret_copy = COption_u16Z_clone(orig_conv);
22083         int64_t ret_ref = tag_ptr(ret_copy, true);
22084         return ret_ref;
22085 }
22086
22087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1some(JNIEnv *env, jclass clz, jboolean o) {
22088         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22089         *ret_copy = COption_boolZ_some(o);
22090         int64_t ret_ref = tag_ptr(ret_copy, true);
22091         return ret_ref;
22092 }
22093
22094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1none(JNIEnv *env, jclass clz) {
22095         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22096         *ret_copy = COption_boolZ_none();
22097         int64_t ret_ref = tag_ptr(ret_copy, true);
22098         return ret_ref;
22099 }
22100
22101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22102         if (!ptr_is_owned(_res)) return;
22103         void* _res_ptr = untag_ptr(_res);
22104         CHECK_ACCESS(_res_ptr);
22105         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
22106         FREE(untag_ptr(_res));
22107         COption_boolZ_free(_res_conv);
22108 }
22109
22110 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
22111         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22112         *ret_copy = COption_boolZ_clone(arg);
22113         int64_t ret_ref = tag_ptr(ret_copy, true);
22114         return ret_ref;
22115 }
22116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22117         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
22118         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
22119         return ret_conv;
22120 }
22121
22122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22123         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
22124         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22125         *ret_copy = COption_boolZ_clone(orig_conv);
22126         int64_t ret_ref = tag_ptr(ret_copy, true);
22127         return ret_ref;
22128 }
22129
22130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22131         LDKCVec_CVec_u8ZZ _res_constr;
22132         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22133         if (_res_constr.datalen > 0)
22134                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
22135         else
22136                 _res_constr.data = NULL;
22137         for (size_t i = 0; i < _res_constr.datalen; i++) {
22138                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22139                 LDKCVec_u8Z _res_conv_8_ref;
22140                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
22141                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
22142                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
22143                 _res_constr.data[i] = _res_conv_8_ref;
22144         }
22145         CVec_CVec_u8ZZ_free(_res_constr);
22146 }
22147
22148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
22149         LDKCVec_CVec_u8ZZ o_constr;
22150         o_constr.datalen = (*env)->GetArrayLength(env, o);
22151         if (o_constr.datalen > 0)
22152                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
22153         else
22154                 o_constr.data = NULL;
22155         for (size_t i = 0; i < o_constr.datalen; i++) {
22156                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
22157                 LDKCVec_u8Z o_conv_8_ref;
22158                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
22159                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
22160                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
22161                 o_constr.data[i] = o_conv_8_ref;
22162         }
22163         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22164         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
22165         return tag_ptr(ret_conv, true);
22166 }
22167
22168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
22169         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22170         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
22171         return tag_ptr(ret_conv, true);
22172 }
22173
22174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22175         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
22176         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
22177         return ret_conv;
22178 }
22179
22180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22181         if (!ptr_is_owned(_res)) return;
22182         void* _res_ptr = untag_ptr(_res);
22183         CHECK_ACCESS(_res_ptr);
22184         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
22185         FREE(untag_ptr(_res));
22186         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
22187 }
22188
22189 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
22190         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22191         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
22192         return tag_ptr(ret_conv, true);
22193 }
22194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22195         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
22196         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
22197         return ret_conv;
22198 }
22199
22200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22201         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
22202         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22203         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
22204         return tag_ptr(ret_conv, true);
22205 }
22206
22207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22208         LDKInMemorySigner o_conv;
22209         o_conv.inner = untag_ptr(o);
22210         o_conv.is_owned = ptr_is_owned(o);
22211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22212         o_conv = InMemorySigner_clone(&o_conv);
22213         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22214         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
22215         return tag_ptr(ret_conv, true);
22216 }
22217
22218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22219         void* e_ptr = untag_ptr(e);
22220         CHECK_ACCESS(e_ptr);
22221         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22222         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22223         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22224         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
22225         return tag_ptr(ret_conv, true);
22226 }
22227
22228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22229         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
22230         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
22231         return ret_conv;
22232 }
22233
22234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22235         if (!ptr_is_owned(_res)) return;
22236         void* _res_ptr = untag_ptr(_res);
22237         CHECK_ACCESS(_res_ptr);
22238         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
22239         FREE(untag_ptr(_res));
22240         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
22241 }
22242
22243 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
22244         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22245         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
22246         return tag_ptr(ret_conv, true);
22247 }
22248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22249         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
22250         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
22251         return ret_conv;
22252 }
22253
22254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22255         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
22256         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22257         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
22258         return tag_ptr(ret_conv, true);
22259 }
22260
22261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22262         LDKTransaction o_ref;
22263         o_ref.datalen = (*env)->GetArrayLength(env, o);
22264         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
22265         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
22266         o_ref.data_is_owned = true;
22267         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22268         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
22269         return tag_ptr(ret_conv, true);
22270 }
22271
22272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
22273         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22274         *ret_conv = CResult_TransactionNoneZ_err();
22275         return tag_ptr(ret_conv, true);
22276 }
22277
22278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22279         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
22280         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
22281         return ret_conv;
22282 }
22283
22284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22285         if (!ptr_is_owned(_res)) return;
22286         void* _res_ptr = untag_ptr(_res);
22287         CHECK_ACCESS(_res_ptr);
22288         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
22289         FREE(untag_ptr(_res));
22290         CResult_TransactionNoneZ_free(_res_conv);
22291 }
22292
22293 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
22294         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22295         *ret_conv = CResult_TransactionNoneZ_clone(arg);
22296         return tag_ptr(ret_conv, true);
22297 }
22298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22299         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
22300         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
22301         return ret_conv;
22302 }
22303
22304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22305         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
22306         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22307         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
22308         return tag_ptr(ret_conv, true);
22309 }
22310
22311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22312         void* o_ptr = untag_ptr(o);
22313         CHECK_ACCESS(o_ptr);
22314         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
22315         if (o_conv.free == LDKWriteableScore_JCalls_free) {
22316                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22317                 LDKWriteableScore_JCalls_cloned(&o_conv);
22318         }
22319         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
22320         *ret_copy = COption_WriteableScoreZ_some(o_conv);
22321         int64_t ret_ref = tag_ptr(ret_copy, true);
22322         return ret_ref;
22323 }
22324
22325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
22326         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
22327         *ret_copy = COption_WriteableScoreZ_none();
22328         int64_t ret_ref = tag_ptr(ret_copy, true);
22329         return ret_ref;
22330 }
22331
22332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22333         if (!ptr_is_owned(_res)) return;
22334         void* _res_ptr = untag_ptr(_res);
22335         CHECK_ACCESS(_res_ptr);
22336         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
22337         FREE(untag_ptr(_res));
22338         COption_WriteableScoreZ_free(_res_conv);
22339 }
22340
22341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1ok(JNIEnv *env, jclass clz) {
22342         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22343         *ret_conv = CResult_NoneIOErrorZ_ok();
22344         return tag_ptr(ret_conv, true);
22345 }
22346
22347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
22348         LDKIOError e_conv = LDKIOError_from_java(env, e);
22349         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22350         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
22351         return tag_ptr(ret_conv, true);
22352 }
22353
22354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22355         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
22356         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
22357         return ret_conv;
22358 }
22359
22360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22361         if (!ptr_is_owned(_res)) return;
22362         void* _res_ptr = untag_ptr(_res);
22363         CHECK_ACCESS(_res_ptr);
22364         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
22365         FREE(untag_ptr(_res));
22366         CResult_NoneIOErrorZ_free(_res_conv);
22367 }
22368
22369 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
22370         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22371         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
22372         return tag_ptr(ret_conv, true);
22373 }
22374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22375         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
22376         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
22377         return ret_conv;
22378 }
22379
22380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22381         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
22382         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22383         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
22384         return tag_ptr(ret_conv, true);
22385 }
22386
22387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22388         LDKCVec_ChannelDetailsZ _res_constr;
22389         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22390         if (_res_constr.datalen > 0)
22391                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22392         else
22393                 _res_constr.data = NULL;
22394         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22395         for (size_t q = 0; q < _res_constr.datalen; q++) {
22396                 int64_t _res_conv_16 = _res_vals[q];
22397                 LDKChannelDetails _res_conv_16_conv;
22398                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
22399                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
22400                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
22401                 _res_constr.data[q] = _res_conv_16_conv;
22402         }
22403         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22404         CVec_ChannelDetailsZ_free(_res_constr);
22405 }
22406
22407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22408         LDKRoute o_conv;
22409         o_conv.inner = untag_ptr(o);
22410         o_conv.is_owned = ptr_is_owned(o);
22411         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22412         o_conv = Route_clone(&o_conv);
22413         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22414         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
22415         return tag_ptr(ret_conv, true);
22416 }
22417
22418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22419         LDKLightningError e_conv;
22420         e_conv.inner = untag_ptr(e);
22421         e_conv.is_owned = ptr_is_owned(e);
22422         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22423         e_conv = LightningError_clone(&e_conv);
22424         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22425         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
22426         return tag_ptr(ret_conv, true);
22427 }
22428
22429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22430         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
22431         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
22432         return ret_conv;
22433 }
22434
22435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22436         if (!ptr_is_owned(_res)) return;
22437         void* _res_ptr = untag_ptr(_res);
22438         CHECK_ACCESS(_res_ptr);
22439         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
22440         FREE(untag_ptr(_res));
22441         CResult_RouteLightningErrorZ_free(_res_conv);
22442 }
22443
22444 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
22445         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22446         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
22447         return tag_ptr(ret_conv, true);
22448 }
22449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22450         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
22451         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
22452         return ret_conv;
22453 }
22454
22455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22456         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
22457         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22458         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
22459         return tag_ptr(ret_conv, true);
22460 }
22461
22462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22463         LDKInFlightHtlcs o_conv;
22464         o_conv.inner = untag_ptr(o);
22465         o_conv.is_owned = ptr_is_owned(o);
22466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22467         o_conv = InFlightHtlcs_clone(&o_conv);
22468         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22469         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
22470         return tag_ptr(ret_conv, true);
22471 }
22472
22473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22474         void* e_ptr = untag_ptr(e);
22475         CHECK_ACCESS(e_ptr);
22476         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22477         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22478         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22479         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
22480         return tag_ptr(ret_conv, true);
22481 }
22482
22483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22484         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
22485         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
22486         return ret_conv;
22487 }
22488
22489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22490         if (!ptr_is_owned(_res)) return;
22491         void* _res_ptr = untag_ptr(_res);
22492         CHECK_ACCESS(_res_ptr);
22493         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
22494         FREE(untag_ptr(_res));
22495         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
22496 }
22497
22498 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
22499         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22500         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
22501         return tag_ptr(ret_conv, true);
22502 }
22503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22504         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
22505         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
22506         return ret_conv;
22507 }
22508
22509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22510         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
22511         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22512         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
22513         return tag_ptr(ret_conv, true);
22514 }
22515
22516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22517         LDKRouteHop o_conv;
22518         o_conv.inner = untag_ptr(o);
22519         o_conv.is_owned = ptr_is_owned(o);
22520         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22521         o_conv = RouteHop_clone(&o_conv);
22522         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22523         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
22524         return tag_ptr(ret_conv, true);
22525 }
22526
22527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22528         void* e_ptr = untag_ptr(e);
22529         CHECK_ACCESS(e_ptr);
22530         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22531         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22532         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22533         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
22534         return tag_ptr(ret_conv, true);
22535 }
22536
22537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22538         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
22539         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
22540         return ret_conv;
22541 }
22542
22543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22544         if (!ptr_is_owned(_res)) return;
22545         void* _res_ptr = untag_ptr(_res);
22546         CHECK_ACCESS(_res_ptr);
22547         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
22548         FREE(untag_ptr(_res));
22549         CResult_RouteHopDecodeErrorZ_free(_res_conv);
22550 }
22551
22552 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
22553         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22554         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
22555         return tag_ptr(ret_conv, true);
22556 }
22557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22558         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
22559         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
22560         return ret_conv;
22561 }
22562
22563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22564         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
22565         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22566         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
22567         return tag_ptr(ret_conv, true);
22568 }
22569
22570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22571         LDKCVec_BlindedHopZ _res_constr;
22572         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22573         if (_res_constr.datalen > 0)
22574                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
22575         else
22576                 _res_constr.data = NULL;
22577         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22578         for (size_t m = 0; m < _res_constr.datalen; m++) {
22579                 int64_t _res_conv_12 = _res_vals[m];
22580                 LDKBlindedHop _res_conv_12_conv;
22581                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
22582                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
22583                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
22584                 _res_constr.data[m] = _res_conv_12_conv;
22585         }
22586         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22587         CVec_BlindedHopZ_free(_res_constr);
22588 }
22589
22590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22591         LDKBlindedTail o_conv;
22592         o_conv.inner = untag_ptr(o);
22593         o_conv.is_owned = ptr_is_owned(o);
22594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22595         o_conv = BlindedTail_clone(&o_conv);
22596         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
22597         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
22598         return tag_ptr(ret_conv, true);
22599 }
22600
22601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22602         void* e_ptr = untag_ptr(e);
22603         CHECK_ACCESS(e_ptr);
22604         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22605         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22606         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
22607         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
22608         return tag_ptr(ret_conv, true);
22609 }
22610
22611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22612         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
22613         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
22614         return ret_conv;
22615 }
22616
22617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22618         if (!ptr_is_owned(_res)) return;
22619         void* _res_ptr = untag_ptr(_res);
22620         CHECK_ACCESS(_res_ptr);
22621         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
22622         FREE(untag_ptr(_res));
22623         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
22624 }
22625
22626 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
22627         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
22628         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
22629         return tag_ptr(ret_conv, true);
22630 }
22631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22632         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
22633         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
22634         return ret_conv;
22635 }
22636
22637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22638         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
22639         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
22640         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
22641         return tag_ptr(ret_conv, true);
22642 }
22643
22644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22645         LDKCVec_RouteHopZ _res_constr;
22646         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22647         if (_res_constr.datalen > 0)
22648                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22649         else
22650                 _res_constr.data = NULL;
22651         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22652         for (size_t k = 0; k < _res_constr.datalen; k++) {
22653                 int64_t _res_conv_10 = _res_vals[k];
22654                 LDKRouteHop _res_conv_10_conv;
22655                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
22656                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
22657                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
22658                 _res_constr.data[k] = _res_conv_10_conv;
22659         }
22660         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22661         CVec_RouteHopZ_free(_res_constr);
22662 }
22663
22664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22665         LDKCVec_PathZ _res_constr;
22666         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22667         if (_res_constr.datalen > 0)
22668                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
22669         else
22670                 _res_constr.data = NULL;
22671         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22672         for (size_t g = 0; g < _res_constr.datalen; g++) {
22673                 int64_t _res_conv_6 = _res_vals[g];
22674                 LDKPath _res_conv_6_conv;
22675                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
22676                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
22677                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
22678                 _res_constr.data[g] = _res_conv_6_conv;
22679         }
22680         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22681         CVec_PathZ_free(_res_constr);
22682 }
22683
22684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22685         LDKRoute o_conv;
22686         o_conv.inner = untag_ptr(o);
22687         o_conv.is_owned = ptr_is_owned(o);
22688         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22689         o_conv = Route_clone(&o_conv);
22690         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22691         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
22692         return tag_ptr(ret_conv, true);
22693 }
22694
22695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22696         void* e_ptr = untag_ptr(e);
22697         CHECK_ACCESS(e_ptr);
22698         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22699         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22700         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22701         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
22702         return tag_ptr(ret_conv, true);
22703 }
22704
22705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22706         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
22707         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
22708         return ret_conv;
22709 }
22710
22711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22712         if (!ptr_is_owned(_res)) return;
22713         void* _res_ptr = untag_ptr(_res);
22714         CHECK_ACCESS(_res_ptr);
22715         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
22716         FREE(untag_ptr(_res));
22717         CResult_RouteDecodeErrorZ_free(_res_conv);
22718 }
22719
22720 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
22721         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22722         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
22723         return tag_ptr(ret_conv, true);
22724 }
22725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22726         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
22727         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
22728         return ret_conv;
22729 }
22730
22731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22732         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
22733         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22734         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
22735         return tag_ptr(ret_conv, true);
22736 }
22737
22738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22739         LDKRouteParameters o_conv;
22740         o_conv.inner = untag_ptr(o);
22741         o_conv.is_owned = ptr_is_owned(o);
22742         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22743         o_conv = RouteParameters_clone(&o_conv);
22744         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
22745         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
22746         return tag_ptr(ret_conv, true);
22747 }
22748
22749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22750         void* e_ptr = untag_ptr(e);
22751         CHECK_ACCESS(e_ptr);
22752         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22753         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22754         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
22755         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
22756         return tag_ptr(ret_conv, true);
22757 }
22758
22759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22760         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
22761         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
22762         return ret_conv;
22763 }
22764
22765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22766         if (!ptr_is_owned(_res)) return;
22767         void* _res_ptr = untag_ptr(_res);
22768         CHECK_ACCESS(_res_ptr);
22769         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
22770         FREE(untag_ptr(_res));
22771         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
22772 }
22773
22774 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
22775         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
22776         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
22777         return tag_ptr(ret_conv, true);
22778 }
22779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22780         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
22781         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
22782         return ret_conv;
22783 }
22784
22785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22786         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
22787         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
22788         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
22789         return tag_ptr(ret_conv, true);
22790 }
22791
22792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22793         LDKCVec_u64Z _res_constr;
22794         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22795         if (_res_constr.datalen > 0)
22796                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22797         else
22798                 _res_constr.data = NULL;
22799         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22800         for (size_t g = 0; g < _res_constr.datalen; g++) {
22801                 int64_t _res_conv_6 = _res_vals[g];
22802                 _res_constr.data[g] = _res_conv_6;
22803         }
22804         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22805         CVec_u64Z_free(_res_constr);
22806 }
22807
22808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22809         LDKPaymentParameters o_conv;
22810         o_conv.inner = untag_ptr(o);
22811         o_conv.is_owned = ptr_is_owned(o);
22812         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22813         o_conv = PaymentParameters_clone(&o_conv);
22814         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
22815         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
22816         return tag_ptr(ret_conv, true);
22817 }
22818
22819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22820         void* e_ptr = untag_ptr(e);
22821         CHECK_ACCESS(e_ptr);
22822         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22823         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22824         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
22825         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
22826         return tag_ptr(ret_conv, true);
22827 }
22828
22829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22830         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
22831         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
22832         return ret_conv;
22833 }
22834
22835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22836         if (!ptr_is_owned(_res)) return;
22837         void* _res_ptr = untag_ptr(_res);
22838         CHECK_ACCESS(_res_ptr);
22839         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
22840         FREE(untag_ptr(_res));
22841         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
22842 }
22843
22844 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
22845         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
22846         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
22847         return tag_ptr(ret_conv, true);
22848 }
22849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22850         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
22851         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
22852         return ret_conv;
22853 }
22854
22855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22856         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
22857         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
22858         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
22859         return tag_ptr(ret_conv, true);
22860 }
22861
22862 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
22863         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
22864         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
22865         return tag_ptr(ret_conv, true);
22866 }
22867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22868         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
22869         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
22870         return ret_conv;
22871 }
22872
22873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22874         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
22875         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
22876         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
22877         return tag_ptr(ret_conv, true);
22878 }
22879
22880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22881         LDKBlindedPayInfo a_conv;
22882         a_conv.inner = untag_ptr(a);
22883         a_conv.is_owned = ptr_is_owned(a);
22884         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22885         a_conv = BlindedPayInfo_clone(&a_conv);
22886         LDKBlindedPath b_conv;
22887         b_conv.inner = untag_ptr(b);
22888         b_conv.is_owned = ptr_is_owned(b);
22889         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22890         b_conv = BlindedPath_clone(&b_conv);
22891         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
22892         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
22893         return tag_ptr(ret_conv, true);
22894 }
22895
22896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22897         if (!ptr_is_owned(_res)) return;
22898         void* _res_ptr = untag_ptr(_res);
22899         CHECK_ACCESS(_res_ptr);
22900         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
22901         FREE(untag_ptr(_res));
22902         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
22903 }
22904
22905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22906         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
22907         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22908         if (_res_constr.datalen > 0)
22909                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
22910         else
22911                 _res_constr.data = NULL;
22912         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22913         for (size_t l = 0; l < _res_constr.datalen; l++) {
22914                 int64_t _res_conv_37 = _res_vals[l];
22915                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
22916                 CHECK_ACCESS(_res_conv_37_ptr);
22917                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
22918                 FREE(untag_ptr(_res_conv_37));
22919                 _res_constr.data[l] = _res_conv_37_conv;
22920         }
22921         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22922         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
22923 }
22924
22925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22926         LDKCVec_RouteHintZ _res_constr;
22927         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22928         if (_res_constr.datalen > 0)
22929                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
22930         else
22931                 _res_constr.data = NULL;
22932         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22933         for (size_t l = 0; l < _res_constr.datalen; l++) {
22934                 int64_t _res_conv_11 = _res_vals[l];
22935                 LDKRouteHint _res_conv_11_conv;
22936                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
22937                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
22938                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
22939                 _res_constr.data[l] = _res_conv_11_conv;
22940         }
22941         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22942         CVec_RouteHintZ_free(_res_constr);
22943 }
22944
22945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22946         LDKCVec_RouteHintHopZ _res_constr;
22947         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22948         if (_res_constr.datalen > 0)
22949                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
22950         else
22951                 _res_constr.data = NULL;
22952         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22953         for (size_t o = 0; o < _res_constr.datalen; o++) {
22954                 int64_t _res_conv_14 = _res_vals[o];
22955                 LDKRouteHintHop _res_conv_14_conv;
22956                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
22957                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
22958                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
22959                 _res_constr.data[o] = _res_conv_14_conv;
22960         }
22961         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22962         CVec_RouteHintHopZ_free(_res_constr);
22963 }
22964
22965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22966         LDKRouteHint o_conv;
22967         o_conv.inner = untag_ptr(o);
22968         o_conv.is_owned = ptr_is_owned(o);
22969         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22970         o_conv = RouteHint_clone(&o_conv);
22971         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
22972         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
22973         return tag_ptr(ret_conv, true);
22974 }
22975
22976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22977         void* e_ptr = untag_ptr(e);
22978         CHECK_ACCESS(e_ptr);
22979         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22980         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22981         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
22982         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
22983         return tag_ptr(ret_conv, true);
22984 }
22985
22986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22987         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
22988         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
22989         return ret_conv;
22990 }
22991
22992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22993         if (!ptr_is_owned(_res)) return;
22994         void* _res_ptr = untag_ptr(_res);
22995         CHECK_ACCESS(_res_ptr);
22996         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
22997         FREE(untag_ptr(_res));
22998         CResult_RouteHintDecodeErrorZ_free(_res_conv);
22999 }
23000
23001 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
23002         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23003         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
23004         return tag_ptr(ret_conv, true);
23005 }
23006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23007         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
23008         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
23009         return ret_conv;
23010 }
23011
23012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23013         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
23014         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23015         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
23016         return tag_ptr(ret_conv, true);
23017 }
23018
23019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23020         LDKRouteHintHop o_conv;
23021         o_conv.inner = untag_ptr(o);
23022         o_conv.is_owned = ptr_is_owned(o);
23023         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23024         o_conv = RouteHintHop_clone(&o_conv);
23025         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23026         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
23027         return tag_ptr(ret_conv, true);
23028 }
23029
23030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23031         void* e_ptr = untag_ptr(e);
23032         CHECK_ACCESS(e_ptr);
23033         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23034         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23035         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23036         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
23037         return tag_ptr(ret_conv, true);
23038 }
23039
23040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23041         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
23042         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
23043         return ret_conv;
23044 }
23045
23046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23047         if (!ptr_is_owned(_res)) return;
23048         void* _res_ptr = untag_ptr(_res);
23049         CHECK_ACCESS(_res_ptr);
23050         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
23051         FREE(untag_ptr(_res));
23052         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
23053 }
23054
23055 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
23056         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23057         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
23058         return tag_ptr(ret_conv, true);
23059 }
23060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23061         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
23062         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
23063         return ret_conv;
23064 }
23065
23066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23067         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
23068         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23069         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
23070         return tag_ptr(ret_conv, true);
23071 }
23072
23073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
23074         LDKCVec_PublicKeyZ _res_constr;
23075         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23076         if (_res_constr.datalen > 0)
23077                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
23078         else
23079                 _res_constr.data = NULL;
23080         for (size_t i = 0; i < _res_constr.datalen; i++) {
23081                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
23082                 LDKPublicKey _res_conv_8_ref;
23083                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
23084                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
23085                 _res_constr.data[i] = _res_conv_8_ref;
23086         }
23087         CVec_PublicKeyZ_free(_res_constr);
23088 }
23089
23090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23091         LDKFixedPenaltyScorer o_conv;
23092         o_conv.inner = untag_ptr(o);
23093         o_conv.is_owned = ptr_is_owned(o);
23094         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23095         o_conv = FixedPenaltyScorer_clone(&o_conv);
23096         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23097         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
23098         return tag_ptr(ret_conv, true);
23099 }
23100
23101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23102         void* e_ptr = untag_ptr(e);
23103         CHECK_ACCESS(e_ptr);
23104         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23105         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23106         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23107         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
23108         return tag_ptr(ret_conv, true);
23109 }
23110
23111 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23112         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
23113         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
23114         return ret_conv;
23115 }
23116
23117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23118         if (!ptr_is_owned(_res)) return;
23119         void* _res_ptr = untag_ptr(_res);
23120         CHECK_ACCESS(_res_ptr);
23121         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
23122         FREE(untag_ptr(_res));
23123         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
23124 }
23125
23126 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
23127         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23128         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
23129         return tag_ptr(ret_conv, true);
23130 }
23131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23132         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
23133         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
23134         return ret_conv;
23135 }
23136
23137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23138         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
23139         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23140         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
23141         return tag_ptr(ret_conv, true);
23142 }
23143
23144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23145         LDKCVec_NodeIdZ _res_constr;
23146         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23147         if (_res_constr.datalen > 0)
23148                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
23149         else
23150                 _res_constr.data = NULL;
23151         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23152         for (size_t i = 0; i < _res_constr.datalen; i++) {
23153                 int64_t _res_conv_8 = _res_vals[i];
23154                 LDKNodeId _res_conv_8_conv;
23155                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
23156                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
23157                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
23158                 _res_constr.data[i] = _res_conv_8_conv;
23159         }
23160         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23161         CVec_NodeIdZ_free(_res_constr);
23162 }
23163
23164 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
23165         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23166         *ret_conv = C2Tuple_u64u64Z_clone(arg);
23167         return tag_ptr(ret_conv, true);
23168 }
23169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23170         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
23171         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
23172         return ret_conv;
23173 }
23174
23175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23176         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
23177         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23178         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
23179         return tag_ptr(ret_conv, true);
23180 }
23181
23182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23183         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23184         *ret_conv = C2Tuple_u64u64Z_new(a, b);
23185         return tag_ptr(ret_conv, true);
23186 }
23187
23188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23189         if (!ptr_is_owned(_res)) return;
23190         void* _res_ptr = untag_ptr(_res);
23191         CHECK_ACCESS(_res_ptr);
23192         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
23193         FREE(untag_ptr(_res));
23194         C2Tuple_u64u64Z_free(_res_conv);
23195 }
23196
23197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23198         void* o_ptr = untag_ptr(o);
23199         CHECK_ACCESS(o_ptr);
23200         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
23201         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
23202         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23203         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
23204         int64_t ret_ref = tag_ptr(ret_copy, true);
23205         return ret_ref;
23206 }
23207
23208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
23209         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23210         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
23211         int64_t ret_ref = tag_ptr(ret_copy, true);
23212         return ret_ref;
23213 }
23214
23215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23216         if (!ptr_is_owned(_res)) return;
23217         void* _res_ptr = untag_ptr(_res);
23218         CHECK_ACCESS(_res_ptr);
23219         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
23220         FREE(untag_ptr(_res));
23221         COption_C2Tuple_u64u64ZZ_free(_res_conv);
23222 }
23223
23224 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
23225         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23226         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
23227         int64_t ret_ref = tag_ptr(ret_copy, true);
23228         return ret_ref;
23229 }
23230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23231         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
23232         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
23233         return ret_conv;
23234 }
23235
23236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23237         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
23238         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23239         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
23240         int64_t ret_ref = tag_ptr(ret_copy, true);
23241         return ret_ref;
23242 }
23243
23244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
23245         LDKThirtyTwoU16s a_ref;
23246         CHECK((*env)->GetArrayLength(env, a) == 32);
23247         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
23248         LDKThirtyTwoU16s b_ref;
23249         CHECK((*env)->GetArrayLength(env, b) == 32);
23250         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
23251         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
23252         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
23253         return tag_ptr(ret_conv, true);
23254 }
23255
23256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23257         if (!ptr_is_owned(_res)) return;
23258         void* _res_ptr = untag_ptr(_res);
23259         CHECK_ACCESS(_res_ptr);
23260         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
23261         FREE(untag_ptr(_res));
23262         C2Tuple_Z_free(_res_conv);
23263 }
23264
23265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
23266         LDKThirtyTwoU16s a_ref;
23267         CHECK((*env)->GetArrayLength(env, a) == 32);
23268         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
23269         LDKThirtyTwoU16s b_ref;
23270         CHECK((*env)->GetArrayLength(env, b) == 32);
23271         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
23272         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
23273         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
23274         return tag_ptr(ret_conv, true);
23275 }
23276
23277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23278         if (!ptr_is_owned(_res)) return;
23279         void* _res_ptr = untag_ptr(_res);
23280         CHECK_ACCESS(_res_ptr);
23281         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
23282         FREE(untag_ptr(_res));
23283         C2Tuple__u1632_u1632Z_free(_res_conv);
23284 }
23285
23286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23287         void* o_ptr = untag_ptr(o);
23288         CHECK_ACCESS(o_ptr);
23289         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
23290         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
23291         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
23292         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
23293         int64_t ret_ref = tag_ptr(ret_copy, true);
23294         return ret_ref;
23295 }
23296
23297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1none(JNIEnv *env, jclass clz) {
23298         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
23299         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
23300         int64_t ret_ref = tag_ptr(ret_copy, true);
23301         return ret_ref;
23302 }
23303
23304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23305         if (!ptr_is_owned(_res)) return;
23306         void* _res_ptr = untag_ptr(_res);
23307         CHECK_ACCESS(_res_ptr);
23308         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
23309         FREE(untag_ptr(_res));
23310         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
23311 }
23312
23313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1some(JNIEnv *env, jclass clz, double o) {
23314         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23315         *ret_copy = COption_f64Z_some(o);
23316         int64_t ret_ref = tag_ptr(ret_copy, true);
23317         return ret_ref;
23318 }
23319
23320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1none(JNIEnv *env, jclass clz) {
23321         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23322         *ret_copy = COption_f64Z_none();
23323         int64_t ret_ref = tag_ptr(ret_copy, true);
23324         return ret_ref;
23325 }
23326
23327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23328         if (!ptr_is_owned(_res)) return;
23329         void* _res_ptr = untag_ptr(_res);
23330         CHECK_ACCESS(_res_ptr);
23331         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
23332         FREE(untag_ptr(_res));
23333         COption_f64Z_free(_res_conv);
23334 }
23335
23336 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
23337         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23338         *ret_copy = COption_f64Z_clone(arg);
23339         int64_t ret_ref = tag_ptr(ret_copy, true);
23340         return ret_ref;
23341 }
23342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23343         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
23344         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
23345         return ret_conv;
23346 }
23347
23348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23349         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
23350         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23351         *ret_copy = COption_f64Z_clone(orig_conv);
23352         int64_t ret_ref = tag_ptr(ret_copy, true);
23353         return ret_ref;
23354 }
23355
23356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23357         LDKProbabilisticScorer o_conv;
23358         o_conv.inner = untag_ptr(o);
23359         o_conv.is_owned = ptr_is_owned(o);
23360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23361         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
23362         
23363         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
23364         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
23365         return tag_ptr(ret_conv, true);
23366 }
23367
23368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23369         void* e_ptr = untag_ptr(e);
23370         CHECK_ACCESS(e_ptr);
23371         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23372         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23373         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
23374         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
23375         return tag_ptr(ret_conv, true);
23376 }
23377
23378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23379         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
23380         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
23381         return ret_conv;
23382 }
23383
23384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23385         if (!ptr_is_owned(_res)) return;
23386         void* _res_ptr = untag_ptr(_res);
23387         CHECK_ACCESS(_res_ptr);
23388         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
23389         FREE(untag_ptr(_res));
23390         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
23391 }
23392
23393 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
23394         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23395         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
23396         return tag_ptr(ret_conv, true);
23397 }
23398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23399         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
23400         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
23401         return ret_conv;
23402 }
23403
23404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23405         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
23406         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23407         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
23408         return tag_ptr(ret_conv, true);
23409 }
23410
23411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
23412         LDKTransaction b_ref;
23413         b_ref.datalen = (*env)->GetArrayLength(env, b);
23414         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
23415         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
23416         b_ref.data_is_owned = true;
23417         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23418         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
23419         return tag_ptr(ret_conv, true);
23420 }
23421
23422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23423         if (!ptr_is_owned(_res)) return;
23424         void* _res_ptr = untag_ptr(_res);
23425         CHECK_ACCESS(_res_ptr);
23426         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
23427         FREE(untag_ptr(_res));
23428         C2Tuple_usizeTransactionZ_free(_res_conv);
23429 }
23430
23431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23432         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
23433         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23434         if (_res_constr.datalen > 0)
23435                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23436         else
23437                 _res_constr.data = NULL;
23438         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23439         for (size_t c = 0; c < _res_constr.datalen; c++) {
23440                 int64_t _res_conv_28 = _res_vals[c];
23441                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
23442                 CHECK_ACCESS(_res_conv_28_ptr);
23443                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
23444                 FREE(untag_ptr(_res_conv_28));
23445                 _res_constr.data[c] = _res_conv_28_conv;
23446         }
23447         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23448         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
23449 }
23450
23451 static inline uint64_t C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
23452         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23453         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(arg);
23454         return tag_ptr(ret_conv, true);
23455 }
23456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23457         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(arg);
23458         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
23459         return ret_conv;
23460 }
23461
23462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23463         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(orig);
23464         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23465         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig_conv);
23466         return tag_ptr(ret_conv, true);
23467 }
23468
23469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
23470         LDKThirtyTwoBytes a_ref;
23471         CHECK((*env)->GetArrayLength(env, a) == 32);
23472         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23473         void* b_ptr = untag_ptr(b);
23474         CHECK_ACCESS(b_ptr);
23475         LDKCOption_ThirtyTwoBytesZ b_conv = *(LDKCOption_ThirtyTwoBytesZ*)(b_ptr);
23476         b_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(b));
23477         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23478         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a_ref, b_conv);
23479         return tag_ptr(ret_conv, true);
23480 }
23481
23482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23483         if (!ptr_is_owned(_res)) return;
23484         void* _res_ptr = untag_ptr(_res);
23485         CHECK_ACCESS(_res_ptr);
23486         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_ptr);
23487         FREE(untag_ptr(_res));
23488         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res_conv);
23489 }
23490
23491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23492         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res_constr;
23493         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23494         if (_res_constr.datalen > 0)
23495                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
23496         else
23497                 _res_constr.data = NULL;
23498         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23499         for (size_t x = 0; x < _res_constr.datalen; x++) {
23500                 int64_t _res_conv_49 = _res_vals[x];
23501                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
23502                 CHECK_ACCESS(_res_conv_49_ptr);
23503                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_conv_49_ptr);
23504                 FREE(untag_ptr(_res_conv_49));
23505                 _res_constr.data[x] = _res_conv_49_conv;
23506         }
23507         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23508         CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res_constr);
23509 }
23510
23511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
23512         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_java(env, o);
23513         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23514         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
23515         return tag_ptr(ret_conv, true);
23516 }
23517
23518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1err(JNIEnv *env, jclass clz) {
23519         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23520         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
23521         return tag_ptr(ret_conv, true);
23522 }
23523
23524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23525         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
23526         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
23527         return ret_conv;
23528 }
23529
23530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23531         if (!ptr_is_owned(_res)) return;
23532         void* _res_ptr = untag_ptr(_res);
23533         CHECK_ACCESS(_res_ptr);
23534         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
23535         FREE(untag_ptr(_res));
23536         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
23537 }
23538
23539 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
23540         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23541         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
23542         return tag_ptr(ret_conv, true);
23543 }
23544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23545         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
23546         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
23547         return ret_conv;
23548 }
23549
23550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23551         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
23552         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23553         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
23554         return tag_ptr(ret_conv, true);
23555 }
23556
23557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23558         LDKCVec_MonitorEventZ _res_constr;
23559         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23560         if (_res_constr.datalen > 0)
23561                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
23562         else
23563                 _res_constr.data = NULL;
23564         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23565         for (size_t o = 0; o < _res_constr.datalen; o++) {
23566                 int64_t _res_conv_14 = _res_vals[o];
23567                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
23568                 CHECK_ACCESS(_res_conv_14_ptr);
23569                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
23570                 FREE(untag_ptr(_res_conv_14));
23571                 _res_constr.data[o] = _res_conv_14_conv;
23572         }
23573         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23574         CVec_MonitorEventZ_free(_res_constr);
23575 }
23576
23577 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
23578         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23579         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
23580         return tag_ptr(ret_conv, true);
23581 }
23582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23583         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
23584         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
23585         return ret_conv;
23586 }
23587
23588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23589         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
23590         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23591         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
23592         return tag_ptr(ret_conv, true);
23593 }
23594
23595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b, int8_tArray c) {
23596         LDKOutPoint a_conv;
23597         a_conv.inner = untag_ptr(a);
23598         a_conv.is_owned = ptr_is_owned(a);
23599         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23600         a_conv = OutPoint_clone(&a_conv);
23601         LDKCVec_MonitorEventZ b_constr;
23602         b_constr.datalen = (*env)->GetArrayLength(env, b);
23603         if (b_constr.datalen > 0)
23604                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
23605         else
23606                 b_constr.data = NULL;
23607         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
23608         for (size_t o = 0; o < b_constr.datalen; o++) {
23609                 int64_t b_conv_14 = b_vals[o];
23610                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
23611                 CHECK_ACCESS(b_conv_14_ptr);
23612                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
23613                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
23614                 b_constr.data[o] = b_conv_14_conv;
23615         }
23616         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
23617         LDKPublicKey c_ref;
23618         CHECK((*env)->GetArrayLength(env, c) == 33);
23619         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
23620         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23621         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
23622         return tag_ptr(ret_conv, true);
23623 }
23624
23625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23626         if (!ptr_is_owned(_res)) return;
23627         void* _res_ptr = untag_ptr(_res);
23628         CHECK_ACCESS(_res_ptr);
23629         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
23630         FREE(untag_ptr(_res));
23631         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
23632 }
23633
23634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23635         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
23636         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23637         if (_res_constr.datalen > 0)
23638                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
23639         else
23640                 _res_constr.data = NULL;
23641         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23642         for (size_t x = 0; x < _res_constr.datalen; x++) {
23643                 int64_t _res_conv_49 = _res_vals[x];
23644                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
23645                 CHECK_ACCESS(_res_conv_49_ptr);
23646                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
23647                 FREE(untag_ptr(_res_conv_49));
23648                 _res_constr.data[x] = _res_conv_49_conv;
23649         }
23650         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23651         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
23652 }
23653
23654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23655         LDKInitFeatures o_conv;
23656         o_conv.inner = untag_ptr(o);
23657         o_conv.is_owned = ptr_is_owned(o);
23658         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23659         o_conv = InitFeatures_clone(&o_conv);
23660         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23661         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
23662         return tag_ptr(ret_conv, true);
23663 }
23664
23665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23666         void* e_ptr = untag_ptr(e);
23667         CHECK_ACCESS(e_ptr);
23668         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23669         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23670         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23671         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
23672         return tag_ptr(ret_conv, true);
23673 }
23674
23675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23676         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
23677         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
23678         return ret_conv;
23679 }
23680
23681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23682         if (!ptr_is_owned(_res)) return;
23683         void* _res_ptr = untag_ptr(_res);
23684         CHECK_ACCESS(_res_ptr);
23685         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
23686         FREE(untag_ptr(_res));
23687         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
23688 }
23689
23690 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23691         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23692         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
23693         return tag_ptr(ret_conv, true);
23694 }
23695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23696         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
23697         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23698         return ret_conv;
23699 }
23700
23701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23702         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
23703         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23704         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
23705         return tag_ptr(ret_conv, true);
23706 }
23707
23708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23709         LDKChannelFeatures o_conv;
23710         o_conv.inner = untag_ptr(o);
23711         o_conv.is_owned = ptr_is_owned(o);
23712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23713         o_conv = ChannelFeatures_clone(&o_conv);
23714         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23715         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
23716         return tag_ptr(ret_conv, true);
23717 }
23718
23719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23720         void* e_ptr = untag_ptr(e);
23721         CHECK_ACCESS(e_ptr);
23722         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23723         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23724         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23725         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
23726         return tag_ptr(ret_conv, true);
23727 }
23728
23729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23730         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
23731         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
23732         return ret_conv;
23733 }
23734
23735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23736         if (!ptr_is_owned(_res)) return;
23737         void* _res_ptr = untag_ptr(_res);
23738         CHECK_ACCESS(_res_ptr);
23739         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
23740         FREE(untag_ptr(_res));
23741         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
23742 }
23743
23744 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23745         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23746         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
23747         return tag_ptr(ret_conv, true);
23748 }
23749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23750         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
23751         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23752         return ret_conv;
23753 }
23754
23755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23756         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
23757         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23758         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
23759         return tag_ptr(ret_conv, true);
23760 }
23761
23762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23763         LDKNodeFeatures o_conv;
23764         o_conv.inner = untag_ptr(o);
23765         o_conv.is_owned = ptr_is_owned(o);
23766         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23767         o_conv = NodeFeatures_clone(&o_conv);
23768         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23769         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
23770         return tag_ptr(ret_conv, true);
23771 }
23772
23773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23774         void* e_ptr = untag_ptr(e);
23775         CHECK_ACCESS(e_ptr);
23776         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23777         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23778         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23779         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
23780         return tag_ptr(ret_conv, true);
23781 }
23782
23783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23784         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
23785         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
23786         return ret_conv;
23787 }
23788
23789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23790         if (!ptr_is_owned(_res)) return;
23791         void* _res_ptr = untag_ptr(_res);
23792         CHECK_ACCESS(_res_ptr);
23793         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
23794         FREE(untag_ptr(_res));
23795         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
23796 }
23797
23798 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23799         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23800         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
23801         return tag_ptr(ret_conv, true);
23802 }
23803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23804         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
23805         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23806         return ret_conv;
23807 }
23808
23809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23810         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
23811         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23812         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
23813         return tag_ptr(ret_conv, true);
23814 }
23815
23816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23817         LDKBolt11InvoiceFeatures o_conv;
23818         o_conv.inner = untag_ptr(o);
23819         o_conv.is_owned = ptr_is_owned(o);
23820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23821         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
23822         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
23823         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
23824         return tag_ptr(ret_conv, true);
23825 }
23826
23827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23828         void* e_ptr = untag_ptr(e);
23829         CHECK_ACCESS(e_ptr);
23830         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23831         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23832         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
23833         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
23834         return tag_ptr(ret_conv, true);
23835 }
23836
23837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23838         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
23839         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
23840         return ret_conv;
23841 }
23842
23843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23844         if (!ptr_is_owned(_res)) return;
23845         void* _res_ptr = untag_ptr(_res);
23846         CHECK_ACCESS(_res_ptr);
23847         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
23848         FREE(untag_ptr(_res));
23849         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
23850 }
23851
23852 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23853         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
23854         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
23855         return tag_ptr(ret_conv, true);
23856 }
23857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23858         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
23859         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23860         return ret_conv;
23861 }
23862
23863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23864         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
23865         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
23866         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
23867         return tag_ptr(ret_conv, true);
23868 }
23869
23870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23871         LDKBolt12InvoiceFeatures o_conv;
23872         o_conv.inner = untag_ptr(o);
23873         o_conv.is_owned = ptr_is_owned(o);
23874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23875         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
23876         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
23877         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
23878         return tag_ptr(ret_conv, true);
23879 }
23880
23881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23882         void* e_ptr = untag_ptr(e);
23883         CHECK_ACCESS(e_ptr);
23884         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23885         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23886         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
23887         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
23888         return tag_ptr(ret_conv, true);
23889 }
23890
23891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23892         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
23893         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
23894         return ret_conv;
23895 }
23896
23897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23898         if (!ptr_is_owned(_res)) return;
23899         void* _res_ptr = untag_ptr(_res);
23900         CHECK_ACCESS(_res_ptr);
23901         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
23902         FREE(untag_ptr(_res));
23903         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
23904 }
23905
23906 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23907         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
23908         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
23909         return tag_ptr(ret_conv, true);
23910 }
23911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23912         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
23913         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23914         return ret_conv;
23915 }
23916
23917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23918         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
23919         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
23920         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
23921         return tag_ptr(ret_conv, true);
23922 }
23923
23924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23925         LDKBlindedHopFeatures o_conv;
23926         o_conv.inner = untag_ptr(o);
23927         o_conv.is_owned = ptr_is_owned(o);
23928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23929         o_conv = BlindedHopFeatures_clone(&o_conv);
23930         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
23931         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
23932         return tag_ptr(ret_conv, true);
23933 }
23934
23935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23936         void* e_ptr = untag_ptr(e);
23937         CHECK_ACCESS(e_ptr);
23938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23940         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
23941         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
23942         return tag_ptr(ret_conv, true);
23943 }
23944
23945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23946         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
23947         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
23948         return ret_conv;
23949 }
23950
23951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23952         if (!ptr_is_owned(_res)) return;
23953         void* _res_ptr = untag_ptr(_res);
23954         CHECK_ACCESS(_res_ptr);
23955         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
23956         FREE(untag_ptr(_res));
23957         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
23958 }
23959
23960 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
23961         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
23962         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
23963         return tag_ptr(ret_conv, true);
23964 }
23965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23966         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
23967         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
23968         return ret_conv;
23969 }
23970
23971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23972         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
23973         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
23974         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
23975         return tag_ptr(ret_conv, true);
23976 }
23977
23978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23979         LDKChannelTypeFeatures o_conv;
23980         o_conv.inner = untag_ptr(o);
23981         o_conv.is_owned = ptr_is_owned(o);
23982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23983         o_conv = ChannelTypeFeatures_clone(&o_conv);
23984         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
23985         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
23986         return tag_ptr(ret_conv, true);
23987 }
23988
23989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23990         void* e_ptr = untag_ptr(e);
23991         CHECK_ACCESS(e_ptr);
23992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23994         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
23995         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
23996         return tag_ptr(ret_conv, true);
23997 }
23998
23999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24000         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
24001         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
24002         return ret_conv;
24003 }
24004
24005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24006         if (!ptr_is_owned(_res)) return;
24007         void* _res_ptr = untag_ptr(_res);
24008         CHECK_ACCESS(_res_ptr);
24009         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
24010         FREE(untag_ptr(_res));
24011         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
24012 }
24013
24014 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24015         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24016         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
24017         return tag_ptr(ret_conv, true);
24018 }
24019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24020         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
24021         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24022         return ret_conv;
24023 }
24024
24025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24026         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
24027         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24028         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
24029         return tag_ptr(ret_conv, true);
24030 }
24031
24032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24033         LDKOffer o_conv;
24034         o_conv.inner = untag_ptr(o);
24035         o_conv.is_owned = ptr_is_owned(o);
24036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24037         o_conv = Offer_clone(&o_conv);
24038         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24039         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
24040         return tag_ptr(ret_conv, true);
24041 }
24042
24043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24044         LDKBolt12ParseError e_conv;
24045         e_conv.inner = untag_ptr(e);
24046         e_conv.is_owned = ptr_is_owned(e);
24047         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24048         e_conv = Bolt12ParseError_clone(&e_conv);
24049         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24050         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
24051         return tag_ptr(ret_conv, true);
24052 }
24053
24054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24055         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
24056         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
24057         return ret_conv;
24058 }
24059
24060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24061         if (!ptr_is_owned(_res)) return;
24062         void* _res_ptr = untag_ptr(_res);
24063         CHECK_ACCESS(_res_ptr);
24064         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
24065         FREE(untag_ptr(_res));
24066         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
24067 }
24068
24069 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
24070         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24071         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
24072         return tag_ptr(ret_conv, true);
24073 }
24074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24075         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
24076         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
24077         return ret_conv;
24078 }
24079
24080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24081         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
24082         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24083         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
24084         return tag_ptr(ret_conv, true);
24085 }
24086
24087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24088         LDKPublicKey o_ref;
24089         CHECK((*env)->GetArrayLength(env, o) == 33);
24090         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
24091         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24092         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
24093         return tag_ptr(ret_conv, true);
24094 }
24095
24096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24097         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
24098         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24099         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
24100         return tag_ptr(ret_conv, true);
24101 }
24102
24103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24104         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
24105         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
24106         return ret_conv;
24107 }
24108
24109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24110         if (!ptr_is_owned(_res)) return;
24111         void* _res_ptr = untag_ptr(_res);
24112         CHECK_ACCESS(_res_ptr);
24113         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
24114         FREE(untag_ptr(_res));
24115         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
24116 }
24117
24118 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
24119         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24120         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
24121         return tag_ptr(ret_conv, true);
24122 }
24123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24124         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
24125         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
24126         return ret_conv;
24127 }
24128
24129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24130         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
24131         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24132         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
24133         return tag_ptr(ret_conv, true);
24134 }
24135
24136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24137         LDKNodeId o_conv;
24138         o_conv.inner = untag_ptr(o);
24139         o_conv.is_owned = ptr_is_owned(o);
24140         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24141         o_conv = NodeId_clone(&o_conv);
24142         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24143         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
24144         return tag_ptr(ret_conv, true);
24145 }
24146
24147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24148         void* e_ptr = untag_ptr(e);
24149         CHECK_ACCESS(e_ptr);
24150         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24151         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24152         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24153         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
24154         return tag_ptr(ret_conv, true);
24155 }
24156
24157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24158         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
24159         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
24160         return ret_conv;
24161 }
24162
24163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24164         if (!ptr_is_owned(_res)) return;
24165         void* _res_ptr = untag_ptr(_res);
24166         CHECK_ACCESS(_res_ptr);
24167         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
24168         FREE(untag_ptr(_res));
24169         CResult_NodeIdDecodeErrorZ_free(_res_conv);
24170 }
24171
24172 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
24173         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24174         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
24175         return tag_ptr(ret_conv, true);
24176 }
24177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24178         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
24179         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
24180         return ret_conv;
24181 }
24182
24183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24184         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
24185         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24186         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
24187         return tag_ptr(ret_conv, true);
24188 }
24189
24190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24191         void* o_ptr = untag_ptr(o);
24192         CHECK_ACCESS(o_ptr);
24193         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
24194         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
24195         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24196         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
24197         int64_t ret_ref = tag_ptr(ret_copy, true);
24198         return ret_ref;
24199 }
24200
24201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
24202         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24203         *ret_copy = COption_NetworkUpdateZ_none();
24204         int64_t ret_ref = tag_ptr(ret_copy, true);
24205         return ret_ref;
24206 }
24207
24208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24209         if (!ptr_is_owned(_res)) return;
24210         void* _res_ptr = untag_ptr(_res);
24211         CHECK_ACCESS(_res_ptr);
24212         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
24213         FREE(untag_ptr(_res));
24214         COption_NetworkUpdateZ_free(_res_conv);
24215 }
24216
24217 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
24218         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24219         *ret_copy = COption_NetworkUpdateZ_clone(arg);
24220         int64_t ret_ref = tag_ptr(ret_copy, true);
24221         return ret_ref;
24222 }
24223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24224         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
24225         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
24226         return ret_conv;
24227 }
24228
24229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24230         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
24231         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24232         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
24233         int64_t ret_ref = tag_ptr(ret_copy, true);
24234         return ret_ref;
24235 }
24236
24237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24238         void* o_ptr = untag_ptr(o);
24239         CHECK_ACCESS(o_ptr);
24240         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
24241         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
24242         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24243         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
24244         return tag_ptr(ret_conv, true);
24245 }
24246
24247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24248         void* e_ptr = untag_ptr(e);
24249         CHECK_ACCESS(e_ptr);
24250         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24251         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24252         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24253         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
24254         return tag_ptr(ret_conv, true);
24255 }
24256
24257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24258         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
24259         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
24260         return ret_conv;
24261 }
24262
24263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24264         if (!ptr_is_owned(_res)) return;
24265         void* _res_ptr = untag_ptr(_res);
24266         CHECK_ACCESS(_res_ptr);
24267         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
24268         FREE(untag_ptr(_res));
24269         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
24270 }
24271
24272 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
24273         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24274         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
24275         return tag_ptr(ret_conv, true);
24276 }
24277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24278         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
24279         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
24280         return ret_conv;
24281 }
24282
24283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24284         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
24285         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24286         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
24287         return tag_ptr(ret_conv, true);
24288 }
24289
24290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24291         void* o_ptr = untag_ptr(o);
24292         CHECK_ACCESS(o_ptr);
24293         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
24294         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
24295                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24296                 LDKUtxoLookup_JCalls_cloned(&o_conv);
24297         }
24298         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
24299         *ret_copy = COption_UtxoLookupZ_some(o_conv);
24300         int64_t ret_ref = tag_ptr(ret_copy, true);
24301         return ret_ref;
24302 }
24303
24304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
24305         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
24306         *ret_copy = COption_UtxoLookupZ_none();
24307         int64_t ret_ref = tag_ptr(ret_copy, true);
24308         return ret_ref;
24309 }
24310
24311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24312         if (!ptr_is_owned(_res)) return;
24313         void* _res_ptr = untag_ptr(_res);
24314         CHECK_ACCESS(_res_ptr);
24315         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
24316         FREE(untag_ptr(_res));
24317         COption_UtxoLookupZ_free(_res_conv);
24318 }
24319
24320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
24321         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24322         *ret_conv = CResult_NoneLightningErrorZ_ok();
24323         return tag_ptr(ret_conv, true);
24324 }
24325
24326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24327         LDKLightningError e_conv;
24328         e_conv.inner = untag_ptr(e);
24329         e_conv.is_owned = ptr_is_owned(e);
24330         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24331         e_conv = LightningError_clone(&e_conv);
24332         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24333         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
24334         return tag_ptr(ret_conv, true);
24335 }
24336
24337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24338         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
24339         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
24340         return ret_conv;
24341 }
24342
24343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24344         if (!ptr_is_owned(_res)) return;
24345         void* _res_ptr = untag_ptr(_res);
24346         CHECK_ACCESS(_res_ptr);
24347         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
24348         FREE(untag_ptr(_res));
24349         CResult_NoneLightningErrorZ_free(_res_conv);
24350 }
24351
24352 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
24353         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24354         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
24355         return tag_ptr(ret_conv, true);
24356 }
24357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24358         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
24359         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
24360         return ret_conv;
24361 }
24362
24363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24364         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
24365         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24366         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
24367         return tag_ptr(ret_conv, true);
24368 }
24369
24370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
24371         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24372         *ret_conv = CResult_boolLightningErrorZ_ok(o);
24373         return tag_ptr(ret_conv, true);
24374 }
24375
24376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24377         LDKLightningError e_conv;
24378         e_conv.inner = untag_ptr(e);
24379         e_conv.is_owned = ptr_is_owned(e);
24380         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24381         e_conv = LightningError_clone(&e_conv);
24382         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24383         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
24384         return tag_ptr(ret_conv, true);
24385 }
24386
24387 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24388         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
24389         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
24390         return ret_conv;
24391 }
24392
24393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24394         if (!ptr_is_owned(_res)) return;
24395         void* _res_ptr = untag_ptr(_res);
24396         CHECK_ACCESS(_res_ptr);
24397         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
24398         FREE(untag_ptr(_res));
24399         CResult_boolLightningErrorZ_free(_res_conv);
24400 }
24401
24402 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
24403         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24404         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
24405         return tag_ptr(ret_conv, true);
24406 }
24407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24408         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
24409         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
24410         return ret_conv;
24411 }
24412
24413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24414         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
24415         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24416         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
24417         return tag_ptr(ret_conv, true);
24418 }
24419
24420 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
24421         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24422         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
24423         return tag_ptr(ret_conv, true);
24424 }
24425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24426         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
24427         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
24428         return ret_conv;
24429 }
24430
24431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24432         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
24433         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24434         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
24435         return tag_ptr(ret_conv, true);
24436 }
24437
24438 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) {
24439         LDKChannelAnnouncement a_conv;
24440         a_conv.inner = untag_ptr(a);
24441         a_conv.is_owned = ptr_is_owned(a);
24442         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24443         a_conv = ChannelAnnouncement_clone(&a_conv);
24444         LDKChannelUpdate b_conv;
24445         b_conv.inner = untag_ptr(b);
24446         b_conv.is_owned = ptr_is_owned(b);
24447         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24448         b_conv = ChannelUpdate_clone(&b_conv);
24449         LDKChannelUpdate c_conv;
24450         c_conv.inner = untag_ptr(c);
24451         c_conv.is_owned = ptr_is_owned(c);
24452         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24453         c_conv = ChannelUpdate_clone(&c_conv);
24454         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24455         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
24456         return tag_ptr(ret_conv, true);
24457 }
24458
24459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24460         if (!ptr_is_owned(_res)) return;
24461         void* _res_ptr = untag_ptr(_res);
24462         CHECK_ACCESS(_res_ptr);
24463         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
24464         FREE(untag_ptr(_res));
24465         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
24466 }
24467
24468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24469         void* o_ptr = untag_ptr(o);
24470         CHECK_ACCESS(o_ptr);
24471         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
24472         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
24473         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24474         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
24475         int64_t ret_ref = tag_ptr(ret_copy, true);
24476         return ret_ref;
24477 }
24478
24479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
24480         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24481         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
24482         int64_t ret_ref = tag_ptr(ret_copy, true);
24483         return ret_ref;
24484 }
24485
24486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24487         if (!ptr_is_owned(_res)) return;
24488         void* _res_ptr = untag_ptr(_res);
24489         CHECK_ACCESS(_res_ptr);
24490         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
24491         FREE(untag_ptr(_res));
24492         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
24493 }
24494
24495 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
24496         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24497         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
24498         int64_t ret_ref = tag_ptr(ret_copy, true);
24499         return ret_ref;
24500 }
24501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24502         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
24503         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
24504         return ret_conv;
24505 }
24506
24507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24508         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
24509         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24510         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
24511         int64_t ret_ref = tag_ptr(ret_copy, true);
24512         return ret_ref;
24513 }
24514
24515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24516         LDKCVec_MessageSendEventZ _res_constr;
24517         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24518         if (_res_constr.datalen > 0)
24519                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
24520         else
24521                 _res_constr.data = NULL;
24522         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24523         for (size_t s = 0; s < _res_constr.datalen; s++) {
24524                 int64_t _res_conv_18 = _res_vals[s];
24525                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
24526                 CHECK_ACCESS(_res_conv_18_ptr);
24527                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
24528                 FREE(untag_ptr(_res_conv_18));
24529                 _res_constr.data[s] = _res_conv_18_conv;
24530         }
24531         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24532         CVec_MessageSendEventZ_free(_res_constr);
24533 }
24534
24535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24536         LDKChannelUpdateInfo o_conv;
24537         o_conv.inner = untag_ptr(o);
24538         o_conv.is_owned = ptr_is_owned(o);
24539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24540         o_conv = ChannelUpdateInfo_clone(&o_conv);
24541         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24542         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
24543         return tag_ptr(ret_conv, true);
24544 }
24545
24546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24547         void* e_ptr = untag_ptr(e);
24548         CHECK_ACCESS(e_ptr);
24549         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24550         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24551         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24552         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
24553         return tag_ptr(ret_conv, true);
24554 }
24555
24556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24557         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
24558         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
24559         return ret_conv;
24560 }
24561
24562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24563         if (!ptr_is_owned(_res)) return;
24564         void* _res_ptr = untag_ptr(_res);
24565         CHECK_ACCESS(_res_ptr);
24566         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
24567         FREE(untag_ptr(_res));
24568         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
24569 }
24570
24571 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
24572         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24573         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
24574         return tag_ptr(ret_conv, true);
24575 }
24576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24577         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
24578         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
24579         return ret_conv;
24580 }
24581
24582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24583         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
24584         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24585         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
24586         return tag_ptr(ret_conv, true);
24587 }
24588
24589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24590         LDKChannelInfo o_conv;
24591         o_conv.inner = untag_ptr(o);
24592         o_conv.is_owned = ptr_is_owned(o);
24593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24594         o_conv = ChannelInfo_clone(&o_conv);
24595         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24596         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
24597         return tag_ptr(ret_conv, true);
24598 }
24599
24600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24601         void* e_ptr = untag_ptr(e);
24602         CHECK_ACCESS(e_ptr);
24603         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24604         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24605         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24606         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
24607         return tag_ptr(ret_conv, true);
24608 }
24609
24610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24611         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
24612         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
24613         return ret_conv;
24614 }
24615
24616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24617         if (!ptr_is_owned(_res)) return;
24618         void* _res_ptr = untag_ptr(_res);
24619         CHECK_ACCESS(_res_ptr);
24620         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
24621         FREE(untag_ptr(_res));
24622         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
24623 }
24624
24625 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
24626         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24627         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
24628         return tag_ptr(ret_conv, true);
24629 }
24630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24631         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
24632         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
24633         return ret_conv;
24634 }
24635
24636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24637         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
24638         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24639         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
24640         return tag_ptr(ret_conv, true);
24641 }
24642
24643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24644         LDKRoutingFees o_conv;
24645         o_conv.inner = untag_ptr(o);
24646         o_conv.is_owned = ptr_is_owned(o);
24647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24648         o_conv = RoutingFees_clone(&o_conv);
24649         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24650         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
24651         return tag_ptr(ret_conv, true);
24652 }
24653
24654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24655         void* e_ptr = untag_ptr(e);
24656         CHECK_ACCESS(e_ptr);
24657         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24658         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24659         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24660         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
24661         return tag_ptr(ret_conv, true);
24662 }
24663
24664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24665         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
24666         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
24667         return ret_conv;
24668 }
24669
24670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24671         if (!ptr_is_owned(_res)) return;
24672         void* _res_ptr = untag_ptr(_res);
24673         CHECK_ACCESS(_res_ptr);
24674         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
24675         FREE(untag_ptr(_res));
24676         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
24677 }
24678
24679 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
24680         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24681         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
24682         return tag_ptr(ret_conv, true);
24683 }
24684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24685         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
24686         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
24687         return ret_conv;
24688 }
24689
24690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24691         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
24692         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24693         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
24694         return tag_ptr(ret_conv, true);
24695 }
24696
24697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24698         LDKCVec_SocketAddressZ _res_constr;
24699         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24700         if (_res_constr.datalen > 0)
24701                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
24702         else
24703                 _res_constr.data = NULL;
24704         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24705         for (size_t p = 0; p < _res_constr.datalen; p++) {
24706                 int64_t _res_conv_15 = _res_vals[p];
24707                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
24708                 CHECK_ACCESS(_res_conv_15_ptr);
24709                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
24710                 FREE(untag_ptr(_res_conv_15));
24711                 _res_constr.data[p] = _res_conv_15_conv;
24712         }
24713         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24714         CVec_SocketAddressZ_free(_res_constr);
24715 }
24716
24717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24718         LDKNodeAnnouncementInfo o_conv;
24719         o_conv.inner = untag_ptr(o);
24720         o_conv.is_owned = ptr_is_owned(o);
24721         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24722         o_conv = NodeAnnouncementInfo_clone(&o_conv);
24723         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24724         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
24725         return tag_ptr(ret_conv, true);
24726 }
24727
24728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24729         void* e_ptr = untag_ptr(e);
24730         CHECK_ACCESS(e_ptr);
24731         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24732         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24733         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24734         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
24735         return tag_ptr(ret_conv, true);
24736 }
24737
24738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24739         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
24740         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
24741         return ret_conv;
24742 }
24743
24744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24745         if (!ptr_is_owned(_res)) return;
24746         void* _res_ptr = untag_ptr(_res);
24747         CHECK_ACCESS(_res_ptr);
24748         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
24749         FREE(untag_ptr(_res));
24750         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
24751 }
24752
24753 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
24754         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24755         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
24756         return tag_ptr(ret_conv, true);
24757 }
24758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24759         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
24760         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
24761         return ret_conv;
24762 }
24763
24764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24765         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
24766         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24767         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
24768         return tag_ptr(ret_conv, true);
24769 }
24770
24771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24772         LDKNodeAlias o_conv;
24773         o_conv.inner = untag_ptr(o);
24774         o_conv.is_owned = ptr_is_owned(o);
24775         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24776         o_conv = NodeAlias_clone(&o_conv);
24777         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
24778         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
24779         return tag_ptr(ret_conv, true);
24780 }
24781
24782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24783         void* e_ptr = untag_ptr(e);
24784         CHECK_ACCESS(e_ptr);
24785         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24786         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24787         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
24788         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
24789         return tag_ptr(ret_conv, true);
24790 }
24791
24792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24793         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
24794         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
24795         return ret_conv;
24796 }
24797
24798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24799         if (!ptr_is_owned(_res)) return;
24800         void* _res_ptr = untag_ptr(_res);
24801         CHECK_ACCESS(_res_ptr);
24802         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
24803         FREE(untag_ptr(_res));
24804         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
24805 }
24806
24807 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
24808         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
24809         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
24810         return tag_ptr(ret_conv, true);
24811 }
24812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24813         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
24814         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
24815         return ret_conv;
24816 }
24817
24818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24819         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
24820         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
24821         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
24822         return tag_ptr(ret_conv, true);
24823 }
24824
24825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24826         LDKNodeInfo o_conv;
24827         o_conv.inner = untag_ptr(o);
24828         o_conv.is_owned = ptr_is_owned(o);
24829         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24830         o_conv = NodeInfo_clone(&o_conv);
24831         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24832         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
24833         return tag_ptr(ret_conv, true);
24834 }
24835
24836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24837         void* e_ptr = untag_ptr(e);
24838         CHECK_ACCESS(e_ptr);
24839         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24840         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24841         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24842         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
24843         return tag_ptr(ret_conv, true);
24844 }
24845
24846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24847         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
24848         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
24849         return ret_conv;
24850 }
24851
24852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24853         if (!ptr_is_owned(_res)) return;
24854         void* _res_ptr = untag_ptr(_res);
24855         CHECK_ACCESS(_res_ptr);
24856         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
24857         FREE(untag_ptr(_res));
24858         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
24859 }
24860
24861 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
24862         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24863         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
24864         return tag_ptr(ret_conv, true);
24865 }
24866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24867         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
24868         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
24869         return ret_conv;
24870 }
24871
24872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24873         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
24874         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24875         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
24876         return tag_ptr(ret_conv, true);
24877 }
24878
24879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24880         LDKNetworkGraph o_conv;
24881         o_conv.inner = untag_ptr(o);
24882         o_conv.is_owned = ptr_is_owned(o);
24883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24884         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
24885         
24886         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24887         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
24888         return tag_ptr(ret_conv, true);
24889 }
24890
24891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24892         void* e_ptr = untag_ptr(e);
24893         CHECK_ACCESS(e_ptr);
24894         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24895         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24896         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24897         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
24898         return tag_ptr(ret_conv, true);
24899 }
24900
24901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24902         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
24903         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
24904         return ret_conv;
24905 }
24906
24907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24908         if (!ptr_is_owned(_res)) return;
24909         void* _res_ptr = untag_ptr(_res);
24910         CHECK_ACCESS(_res_ptr);
24911         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
24912         FREE(untag_ptr(_res));
24913         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
24914 }
24915
24916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
24917         LDKCVec_SocketAddressZ o_constr;
24918         o_constr.datalen = (*env)->GetArrayLength(env, o);
24919         if (o_constr.datalen > 0)
24920                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
24921         else
24922                 o_constr.data = NULL;
24923         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
24924         for (size_t p = 0; p < o_constr.datalen; p++) {
24925                 int64_t o_conv_15 = o_vals[p];
24926                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
24927                 CHECK_ACCESS(o_conv_15_ptr);
24928                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
24929                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
24930                 o_constr.data[p] = o_conv_15_conv;
24931         }
24932         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
24933         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
24934         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
24935         int64_t ret_ref = tag_ptr(ret_copy, true);
24936         return ret_ref;
24937 }
24938
24939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1none(JNIEnv *env, jclass clz) {
24940         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
24941         *ret_copy = COption_CVec_SocketAddressZZ_none();
24942         int64_t ret_ref = tag_ptr(ret_copy, true);
24943         return ret_ref;
24944 }
24945
24946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24947         if (!ptr_is_owned(_res)) return;
24948         void* _res_ptr = untag_ptr(_res);
24949         CHECK_ACCESS(_res_ptr);
24950         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
24951         FREE(untag_ptr(_res));
24952         COption_CVec_SocketAddressZZ_free(_res_conv);
24953 }
24954
24955 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
24956         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
24957         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
24958         int64_t ret_ref = tag_ptr(ret_copy, true);
24959         return ret_ref;
24960 }
24961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24962         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
24963         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
24964         return ret_conv;
24965 }
24966
24967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24968         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
24969         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
24970         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
24971         int64_t ret_ref = tag_ptr(ret_copy, true);
24972         return ret_ref;
24973 }
24974
24975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24976         LDKChannelDerivationParameters o_conv;
24977         o_conv.inner = untag_ptr(o);
24978         o_conv.is_owned = ptr_is_owned(o);
24979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24980         o_conv = ChannelDerivationParameters_clone(&o_conv);
24981         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
24982         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
24983         return tag_ptr(ret_conv, true);
24984 }
24985
24986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24987         void* e_ptr = untag_ptr(e);
24988         CHECK_ACCESS(e_ptr);
24989         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24990         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24991         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
24992         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
24993         return tag_ptr(ret_conv, true);
24994 }
24995
24996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24997         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
24998         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
24999         return ret_conv;
25000 }
25001
25002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25003         if (!ptr_is_owned(_res)) return;
25004         void* _res_ptr = untag_ptr(_res);
25005         CHECK_ACCESS(_res_ptr);
25006         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
25007         FREE(untag_ptr(_res));
25008         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
25009 }
25010
25011 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
25012         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25013         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
25014         return tag_ptr(ret_conv, true);
25015 }
25016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25017         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
25018         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
25019         return ret_conv;
25020 }
25021
25022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25023         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
25024         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25025         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
25026         return tag_ptr(ret_conv, true);
25027 }
25028
25029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25030         LDKHTLCDescriptor o_conv;
25031         o_conv.inner = untag_ptr(o);
25032         o_conv.is_owned = ptr_is_owned(o);
25033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25034         o_conv = HTLCDescriptor_clone(&o_conv);
25035         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25036         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
25037         return tag_ptr(ret_conv, true);
25038 }
25039
25040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25041         void* e_ptr = untag_ptr(e);
25042         CHECK_ACCESS(e_ptr);
25043         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25044         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25045         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25046         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
25047         return tag_ptr(ret_conv, true);
25048 }
25049
25050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25051         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
25052         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
25053         return ret_conv;
25054 }
25055
25056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25057         if (!ptr_is_owned(_res)) return;
25058         void* _res_ptr = untag_ptr(_res);
25059         CHECK_ACCESS(_res_ptr);
25060         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
25061         FREE(untag_ptr(_res));
25062         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
25063 }
25064
25065 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25066         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25067         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
25068         return tag_ptr(ret_conv, true);
25069 }
25070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25071         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
25072         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25073         return ret_conv;
25074 }
25075
25076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25077         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
25078         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25079         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
25080         return tag_ptr(ret_conv, true);
25081 }
25082
25083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25084         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
25085         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25086         if (_res_constr.datalen > 0)
25087                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
25088         else
25089                 _res_constr.data = NULL;
25090         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25091         for (size_t y = 0; y < _res_constr.datalen; y++) {
25092                 int64_t _res_conv_24 = _res_vals[y];
25093                 LDKHTLCOutputInCommitment _res_conv_24_conv;
25094                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
25095                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
25096                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
25097                 _res_constr.data[y] = _res_conv_24_conv;
25098         }
25099         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25100         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
25101 }
25102
25103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25104         LDKCVec_HTLCDescriptorZ _res_constr;
25105         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25106         if (_res_constr.datalen > 0)
25107                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
25108         else
25109                 _res_constr.data = NULL;
25110         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25111         for (size_t q = 0; q < _res_constr.datalen; q++) {
25112                 int64_t _res_conv_16 = _res_vals[q];
25113                 LDKHTLCDescriptor _res_conv_16_conv;
25114                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25115                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25116                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25117                 _res_constr.data[q] = _res_conv_16_conv;
25118         }
25119         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25120         CVec_HTLCDescriptorZ_free(_res_constr);
25121 }
25122
25123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25124         LDKCVec_UtxoZ _res_constr;
25125         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25126         if (_res_constr.datalen > 0)
25127                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
25128         else
25129                 _res_constr.data = NULL;
25130         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25131         for (size_t g = 0; g < _res_constr.datalen; g++) {
25132                 int64_t _res_conv_6 = _res_vals[g];
25133                 LDKUtxo _res_conv_6_conv;
25134                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
25135                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
25136                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
25137                 _res_constr.data[g] = _res_conv_6_conv;
25138         }
25139         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25140         CVec_UtxoZ_free(_res_constr);
25141 }
25142
25143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25144         void* o_ptr = untag_ptr(o);
25145         CHECK_ACCESS(o_ptr);
25146         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
25147         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
25148         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25149         *ret_copy = COption_TxOutZ_some(o_conv);
25150         int64_t ret_ref = tag_ptr(ret_copy, true);
25151         return ret_ref;
25152 }
25153
25154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
25155         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25156         *ret_copy = COption_TxOutZ_none();
25157         int64_t ret_ref = tag_ptr(ret_copy, true);
25158         return ret_ref;
25159 }
25160
25161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25162         if (!ptr_is_owned(_res)) return;
25163         void* _res_ptr = untag_ptr(_res);
25164         CHECK_ACCESS(_res_ptr);
25165         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
25166         FREE(untag_ptr(_res));
25167         COption_TxOutZ_free(_res_conv);
25168 }
25169
25170 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
25171         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25172         *ret_copy = COption_TxOutZ_clone(arg);
25173         int64_t ret_ref = tag_ptr(ret_copy, true);
25174         return ret_ref;
25175 }
25176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25177         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
25178         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
25179         return ret_conv;
25180 }
25181
25182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25183         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
25184         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25185         *ret_copy = COption_TxOutZ_clone(orig_conv);
25186         int64_t ret_ref = tag_ptr(ret_copy, true);
25187         return ret_ref;
25188 }
25189
25190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25191         LDKCVec_InputZ _res_constr;
25192         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25193         if (_res_constr.datalen > 0)
25194                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
25195         else
25196                 _res_constr.data = NULL;
25197         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25198         for (size_t h = 0; h < _res_constr.datalen; h++) {
25199                 int64_t _res_conv_7 = _res_vals[h];
25200                 LDKInput _res_conv_7_conv;
25201                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
25202                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
25203                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
25204                 _res_constr.data[h] = _res_conv_7_conv;
25205         }
25206         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25207         CVec_InputZ_free(_res_constr);
25208 }
25209
25210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25211         LDKCoinSelection o_conv;
25212         o_conv.inner = untag_ptr(o);
25213         o_conv.is_owned = ptr_is_owned(o);
25214         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25215         o_conv = CoinSelection_clone(&o_conv);
25216         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25217         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
25218         return tag_ptr(ret_conv, true);
25219 }
25220
25221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
25222         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25223         *ret_conv = CResult_CoinSelectionNoneZ_err();
25224         return tag_ptr(ret_conv, true);
25225 }
25226
25227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25228         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
25229         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
25230         return ret_conv;
25231 }
25232
25233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25234         if (!ptr_is_owned(_res)) return;
25235         void* _res_ptr = untag_ptr(_res);
25236         CHECK_ACCESS(_res_ptr);
25237         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
25238         FREE(untag_ptr(_res));
25239         CResult_CoinSelectionNoneZ_free(_res_conv);
25240 }
25241
25242 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
25243         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25244         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
25245         return tag_ptr(ret_conv, true);
25246 }
25247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25248         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
25249         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
25250         return ret_conv;
25251 }
25252
25253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25254         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
25255         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25256         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
25257         return tag_ptr(ret_conv, true);
25258 }
25259
25260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
25261         LDKCVec_UtxoZ o_constr;
25262         o_constr.datalen = (*env)->GetArrayLength(env, o);
25263         if (o_constr.datalen > 0)
25264                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
25265         else
25266                 o_constr.data = NULL;
25267         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
25268         for (size_t g = 0; g < o_constr.datalen; g++) {
25269                 int64_t o_conv_6 = o_vals[g];
25270                 LDKUtxo o_conv_6_conv;
25271                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
25272                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
25273                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
25274                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
25275                 o_constr.data[g] = o_conv_6_conv;
25276         }
25277         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
25278         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25279         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
25280         return tag_ptr(ret_conv, true);
25281 }
25282
25283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
25284         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25285         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
25286         return tag_ptr(ret_conv, true);
25287 }
25288
25289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25290         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
25291         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
25292         return ret_conv;
25293 }
25294
25295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25296         if (!ptr_is_owned(_res)) return;
25297         void* _res_ptr = untag_ptr(_res);
25298         CHECK_ACCESS(_res_ptr);
25299         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
25300         FREE(untag_ptr(_res));
25301         CResult_CVec_UtxoZNoneZ_free(_res_conv);
25302 }
25303
25304 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
25305         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25306         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
25307         return tag_ptr(ret_conv, true);
25308 }
25309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25310         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
25311         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
25312         return ret_conv;
25313 }
25314
25315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25316         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
25317         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25318         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
25319         return tag_ptr(ret_conv, true);
25320 }
25321
25322 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
25323         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25324         *ret_conv = C2Tuple_u64u16Z_clone(arg);
25325         return tag_ptr(ret_conv, true);
25326 }
25327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25328         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
25329         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
25330         return ret_conv;
25331 }
25332
25333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25334         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
25335         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25336         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
25337         return tag_ptr(ret_conv, true);
25338 }
25339
25340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1new(JNIEnv *env, jclass clz, int64_t a, int16_t b) {
25341         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25342         *ret_conv = C2Tuple_u64u16Z_new(a, b);
25343         return tag_ptr(ret_conv, true);
25344 }
25345
25346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25347         if (!ptr_is_owned(_res)) return;
25348         void* _res_ptr = untag_ptr(_res);
25349         CHECK_ACCESS(_res_ptr);
25350         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
25351         FREE(untag_ptr(_res));
25352         C2Tuple_u64u16Z_free(_res_conv);
25353 }
25354
25355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25356         void* o_ptr = untag_ptr(o);
25357         CHECK_ACCESS(o_ptr);
25358         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
25359         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
25360         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25361         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
25362         int64_t ret_ref = tag_ptr(ret_copy, true);
25363         return ret_ref;
25364 }
25365
25366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1none(JNIEnv *env, jclass clz) {
25367         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25368         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
25369         int64_t ret_ref = tag_ptr(ret_copy, true);
25370         return ret_ref;
25371 }
25372
25373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25374         if (!ptr_is_owned(_res)) return;
25375         void* _res_ptr = untag_ptr(_res);
25376         CHECK_ACCESS(_res_ptr);
25377         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
25378         FREE(untag_ptr(_res));
25379         COption_C2Tuple_u64u16ZZ_free(_res_conv);
25380 }
25381
25382 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
25383         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25384         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
25385         int64_t ret_ref = tag_ptr(ret_copy, true);
25386         return ret_ref;
25387 }
25388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25389         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
25390         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
25391         return ret_conv;
25392 }
25393
25394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25395         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
25396         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25397         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
25398         int64_t ret_ref = tag_ptr(ret_copy, true);
25399         return ret_ref;
25400 }
25401
25402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
25403         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
25404         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25405         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
25406         int64_t ret_ref = tag_ptr(ret_copy, true);
25407         return ret_ref;
25408 }
25409
25410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
25411         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25412         *ret_copy = COption_ChannelShutdownStateZ_none();
25413         int64_t ret_ref = tag_ptr(ret_copy, true);
25414         return ret_ref;
25415 }
25416
25417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25418         if (!ptr_is_owned(_res)) return;
25419         void* _res_ptr = untag_ptr(_res);
25420         CHECK_ACCESS(_res_ptr);
25421         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
25422         FREE(untag_ptr(_res));
25423         COption_ChannelShutdownStateZ_free(_res_conv);
25424 }
25425
25426 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
25427         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25428         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
25429         int64_t ret_ref = tag_ptr(ret_copy, true);
25430         return ret_ref;
25431 }
25432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25433         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
25434         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
25435         return ret_conv;
25436 }
25437
25438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25439         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
25440         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25441         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
25442         int64_t ret_ref = tag_ptr(ret_copy, true);
25443         return ret_ref;
25444 }
25445
25446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25447         LDKThirtyTwoBytes o_ref;
25448         CHECK((*env)->GetArrayLength(env, o) == 32);
25449         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25450         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25451         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
25452         return tag_ptr(ret_conv, true);
25453 }
25454
25455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25456         void* e_ptr = untag_ptr(e);
25457         CHECK_ACCESS(e_ptr);
25458         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
25459         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
25460         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25461         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
25462         return tag_ptr(ret_conv, true);
25463 }
25464
25465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25466         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
25467         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
25468         return ret_conv;
25469 }
25470
25471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25472         if (!ptr_is_owned(_res)) return;
25473         void* _res_ptr = untag_ptr(_res);
25474         CHECK_ACCESS(_res_ptr);
25475         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
25476         FREE(untag_ptr(_res));
25477         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
25478 }
25479
25480 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
25481         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25482         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
25483         return tag_ptr(ret_conv, true);
25484 }
25485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25486         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
25487         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
25488         return ret_conv;
25489 }
25490
25491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25492         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
25493         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25494         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
25495         return tag_ptr(ret_conv, true);
25496 }
25497
25498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25499         LDKCVec_RecentPaymentDetailsZ _res_constr;
25500         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25501         if (_res_constr.datalen > 0)
25502                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
25503         else
25504                 _res_constr.data = NULL;
25505         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25506         for (size_t w = 0; w < _res_constr.datalen; w++) {
25507                 int64_t _res_conv_22 = _res_vals[w];
25508                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
25509                 CHECK_ACCESS(_res_conv_22_ptr);
25510                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
25511                 FREE(untag_ptr(_res_conv_22));
25512                 _res_constr.data[w] = _res_conv_22_conv;
25513         }
25514         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25515         CVec_RecentPaymentDetailsZ_free(_res_constr);
25516 }
25517
25518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
25519         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25520         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
25521         return tag_ptr(ret_conv, true);
25522 }
25523
25524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25525         void* e_ptr = untag_ptr(e);
25526         CHECK_ACCESS(e_ptr);
25527         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25528         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25529         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25530         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
25531         return tag_ptr(ret_conv, true);
25532 }
25533
25534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25535         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
25536         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
25537         return ret_conv;
25538 }
25539
25540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25541         if (!ptr_is_owned(_res)) return;
25542         void* _res_ptr = untag_ptr(_res);
25543         CHECK_ACCESS(_res_ptr);
25544         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
25545         FREE(untag_ptr(_res));
25546         CResult_NonePaymentSendFailureZ_free(_res_conv);
25547 }
25548
25549 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
25550         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25551         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
25552         return tag_ptr(ret_conv, true);
25553 }
25554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25555         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
25556         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
25557         return ret_conv;
25558 }
25559
25560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25561         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
25562         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25563         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
25564         return tag_ptr(ret_conv, true);
25565 }
25566
25567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
25568         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25569         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
25570         return tag_ptr(ret_conv, true);
25571 }
25572
25573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
25574         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
25575         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25576         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
25577         return tag_ptr(ret_conv, true);
25578 }
25579
25580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25581         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
25582         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
25583         return ret_conv;
25584 }
25585
25586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25587         if (!ptr_is_owned(_res)) return;
25588         void* _res_ptr = untag_ptr(_res);
25589         CHECK_ACCESS(_res_ptr);
25590         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
25591         FREE(untag_ptr(_res));
25592         CResult_NoneRetryableSendFailureZ_free(_res_conv);
25593 }
25594
25595 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
25596         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25597         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
25598         return tag_ptr(ret_conv, true);
25599 }
25600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25601         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
25602         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
25603         return ret_conv;
25604 }
25605
25606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25607         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
25608         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25609         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
25610         return tag_ptr(ret_conv, true);
25611 }
25612
25613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25614         LDKThirtyTwoBytes o_ref;
25615         CHECK((*env)->GetArrayLength(env, o) == 32);
25616         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25617         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25618         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
25619         return tag_ptr(ret_conv, true);
25620 }
25621
25622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25623         void* e_ptr = untag_ptr(e);
25624         CHECK_ACCESS(e_ptr);
25625         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25626         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25627         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25628         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
25629         return tag_ptr(ret_conv, true);
25630 }
25631
25632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25633         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
25634         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
25635         return ret_conv;
25636 }
25637
25638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25639         if (!ptr_is_owned(_res)) return;
25640         void* _res_ptr = untag_ptr(_res);
25641         CHECK_ACCESS(_res_ptr);
25642         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
25643         FREE(untag_ptr(_res));
25644         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
25645 }
25646
25647 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
25648         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25649         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
25650         return tag_ptr(ret_conv, true);
25651 }
25652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25653         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
25654         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
25655         return ret_conv;
25656 }
25657
25658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25659         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
25660         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25661         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
25662         return tag_ptr(ret_conv, true);
25663 }
25664
25665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25666         LDKThirtyTwoBytes o_ref;
25667         CHECK((*env)->GetArrayLength(env, o) == 32);
25668         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25669         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25670         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
25671         return tag_ptr(ret_conv, true);
25672 }
25673
25674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
25675         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
25676         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25677         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
25678         return tag_ptr(ret_conv, true);
25679 }
25680
25681 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25682         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
25683         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
25684         return ret_conv;
25685 }
25686
25687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25688         if (!ptr_is_owned(_res)) return;
25689         void* _res_ptr = untag_ptr(_res);
25690         CHECK_ACCESS(_res_ptr);
25691         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
25692         FREE(untag_ptr(_res));
25693         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
25694 }
25695
25696 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
25697         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25698         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
25699         return tag_ptr(ret_conv, true);
25700 }
25701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25702         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
25703         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
25704         return ret_conv;
25705 }
25706
25707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25708         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
25709         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25710         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
25711         return tag_ptr(ret_conv, true);
25712 }
25713
25714 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
25715         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
25716         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
25717         return tag_ptr(ret_conv, true);
25718 }
25719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25720         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
25721         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
25722         return ret_conv;
25723 }
25724
25725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25726         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
25727         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
25728         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
25729         return tag_ptr(ret_conv, true);
25730 }
25731
25732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
25733         LDKThirtyTwoBytes a_ref;
25734         CHECK((*env)->GetArrayLength(env, a) == 32);
25735         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25736         LDKThirtyTwoBytes b_ref;
25737         CHECK((*env)->GetArrayLength(env, b) == 32);
25738         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
25739         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
25740         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
25741         return tag_ptr(ret_conv, true);
25742 }
25743
25744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25745         if (!ptr_is_owned(_res)) return;
25746         void* _res_ptr = untag_ptr(_res);
25747         CHECK_ACCESS(_res_ptr);
25748         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
25749         FREE(untag_ptr(_res));
25750         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
25751 }
25752
25753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25754         void* o_ptr = untag_ptr(o);
25755         CHECK_ACCESS(o_ptr);
25756         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
25757         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
25758         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
25759         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
25760         return tag_ptr(ret_conv, true);
25761 }
25762
25763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25764         void* e_ptr = untag_ptr(e);
25765         CHECK_ACCESS(e_ptr);
25766         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25767         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25768         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
25769         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
25770         return tag_ptr(ret_conv, true);
25771 }
25772
25773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25774         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
25775         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
25776         return ret_conv;
25777 }
25778
25779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25780         if (!ptr_is_owned(_res)) return;
25781         void* _res_ptr = untag_ptr(_res);
25782         CHECK_ACCESS(_res_ptr);
25783         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
25784         FREE(untag_ptr(_res));
25785         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
25786 }
25787
25788 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
25789         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
25790         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
25791         return tag_ptr(ret_conv, true);
25792 }
25793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25794         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
25795         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
25796         return ret_conv;
25797 }
25798
25799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25800         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
25801         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
25802         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
25803         return tag_ptr(ret_conv, true);
25804 }
25805
25806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25807         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
25808         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25809         if (_res_constr.datalen > 0)
25810                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
25811         else
25812                 _res_constr.data = NULL;
25813         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25814         for (size_t o = 0; o < _res_constr.datalen; o++) {
25815                 int64_t _res_conv_40 = _res_vals[o];
25816                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
25817                 CHECK_ACCESS(_res_conv_40_ptr);
25818                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
25819                 FREE(untag_ptr(_res_conv_40));
25820                 _res_constr.data[o] = _res_conv_40_conv;
25821         }
25822         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25823         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
25824 }
25825
25826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
25827         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
25828         o_constr.datalen = (*env)->GetArrayLength(env, o);
25829         if (o_constr.datalen > 0)
25830                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
25831         else
25832                 o_constr.data = NULL;
25833         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
25834         for (size_t o = 0; o < o_constr.datalen; o++) {
25835                 int64_t o_conv_40 = o_vals[o];
25836                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
25837                 CHECK_ACCESS(o_conv_40_ptr);
25838                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
25839                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
25840                 o_constr.data[o] = o_conv_40_conv;
25841         }
25842         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
25843         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
25844         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
25845         return tag_ptr(ret_conv, true);
25846 }
25847
25848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25849         void* e_ptr = untag_ptr(e);
25850         CHECK_ACCESS(e_ptr);
25851         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
25852         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
25853         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
25854         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
25855         return tag_ptr(ret_conv, true);
25856 }
25857
25858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25859         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
25860         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
25861         return ret_conv;
25862 }
25863
25864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25865         if (!ptr_is_owned(_res)) return;
25866         void* _res_ptr = untag_ptr(_res);
25867         CHECK_ACCESS(_res_ptr);
25868         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
25869         FREE(untag_ptr(_res));
25870         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
25871 }
25872
25873 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
25874         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
25875         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
25876         return tag_ptr(ret_conv, true);
25877 }
25878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25879         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
25880         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
25881         return ret_conv;
25882 }
25883
25884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25885         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
25886         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
25887         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
25888         return tag_ptr(ret_conv, true);
25889 }
25890
25891 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
25892         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
25893         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
25894         return tag_ptr(ret_conv, true);
25895 }
25896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25897         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
25898         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
25899         return ret_conv;
25900 }
25901
25902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25903         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
25904         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
25905         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
25906         return tag_ptr(ret_conv, true);
25907 }
25908
25909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
25910         LDKThirtyTwoBytes a_ref;
25911         CHECK((*env)->GetArrayLength(env, a) == 32);
25912         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25913         LDKPublicKey b_ref;
25914         CHECK((*env)->GetArrayLength(env, b) == 33);
25915         (*env)->GetByteArrayRegion(env, b, 0, 33, b_ref.compressed_form);
25916         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
25917         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
25918         return tag_ptr(ret_conv, true);
25919 }
25920
25921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25922         if (!ptr_is_owned(_res)) return;
25923         void* _res_ptr = untag_ptr(_res);
25924         CHECK_ACCESS(_res_ptr);
25925         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
25926         FREE(untag_ptr(_res));
25927         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
25928 }
25929
25930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25931         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
25932         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25933         if (_res_constr.datalen > 0)
25934                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
25935         else
25936                 _res_constr.data = NULL;
25937         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25938         for (size_t j = 0; j < _res_constr.datalen; j++) {
25939                 int64_t _res_conv_35 = _res_vals[j];
25940                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
25941                 CHECK_ACCESS(_res_conv_35_ptr);
25942                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
25943                 FREE(untag_ptr(_res_conv_35));
25944                 _res_constr.data[j] = _res_conv_35_conv;
25945         }
25946         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25947         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
25948 }
25949
25950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25951         void* o_ptr = untag_ptr(o);
25952         CHECK_ACCESS(o_ptr);
25953         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
25954         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
25955         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
25956         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
25957         return tag_ptr(ret_conv, true);
25958 }
25959
25960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1err(JNIEnv *env, jclass clz) {
25961         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
25962         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
25963         return tag_ptr(ret_conv, true);
25964 }
25965
25966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25967         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
25968         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
25969         return ret_conv;
25970 }
25971
25972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25973         if (!ptr_is_owned(_res)) return;
25974         void* _res_ptr = untag_ptr(_res);
25975         CHECK_ACCESS(_res_ptr);
25976         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
25977         FREE(untag_ptr(_res));
25978         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
25979 }
25980
25981 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
25982         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
25983         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
25984         return tag_ptr(ret_conv, true);
25985 }
25986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25987         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
25988         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
25989         return ret_conv;
25990 }
25991
25992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25993         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
25994         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
25995         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
25996         return tag_ptr(ret_conv, true);
25997 }
25998
25999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26000         LDKCounterpartyForwardingInfo o_conv;
26001         o_conv.inner = untag_ptr(o);
26002         o_conv.is_owned = ptr_is_owned(o);
26003         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26004         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
26005         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26006         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
26007         return tag_ptr(ret_conv, true);
26008 }
26009
26010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26011         void* e_ptr = untag_ptr(e);
26012         CHECK_ACCESS(e_ptr);
26013         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26014         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26015         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26016         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
26017         return tag_ptr(ret_conv, true);
26018 }
26019
26020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26021         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
26022         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
26023         return ret_conv;
26024 }
26025
26026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26027         if (!ptr_is_owned(_res)) return;
26028         void* _res_ptr = untag_ptr(_res);
26029         CHECK_ACCESS(_res_ptr);
26030         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
26031         FREE(untag_ptr(_res));
26032         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
26033 }
26034
26035 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
26036         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26037         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
26038         return tag_ptr(ret_conv, true);
26039 }
26040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26041         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
26042         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
26043         return ret_conv;
26044 }
26045
26046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26047         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
26048         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26049         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
26050         return tag_ptr(ret_conv, true);
26051 }
26052
26053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26054         LDKChannelCounterparty o_conv;
26055         o_conv.inner = untag_ptr(o);
26056         o_conv.is_owned = ptr_is_owned(o);
26057         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26058         o_conv = ChannelCounterparty_clone(&o_conv);
26059         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26060         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
26061         return tag_ptr(ret_conv, true);
26062 }
26063
26064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26065         void* e_ptr = untag_ptr(e);
26066         CHECK_ACCESS(e_ptr);
26067         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26068         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26069         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26070         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
26071         return tag_ptr(ret_conv, true);
26072 }
26073
26074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26075         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
26076         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
26077         return ret_conv;
26078 }
26079
26080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26081         if (!ptr_is_owned(_res)) return;
26082         void* _res_ptr = untag_ptr(_res);
26083         CHECK_ACCESS(_res_ptr);
26084         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
26085         FREE(untag_ptr(_res));
26086         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
26087 }
26088
26089 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
26090         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26091         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
26092         return tag_ptr(ret_conv, true);
26093 }
26094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26095         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
26096         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
26097         return ret_conv;
26098 }
26099
26100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26101         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
26102         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26103         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
26104         return tag_ptr(ret_conv, true);
26105 }
26106
26107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26108         LDKChannelDetails o_conv;
26109         o_conv.inner = untag_ptr(o);
26110         o_conv.is_owned = ptr_is_owned(o);
26111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26112         o_conv = ChannelDetails_clone(&o_conv);
26113         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26114         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
26115         return tag_ptr(ret_conv, true);
26116 }
26117
26118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26119         void* e_ptr = untag_ptr(e);
26120         CHECK_ACCESS(e_ptr);
26121         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26122         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26123         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26124         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
26125         return tag_ptr(ret_conv, true);
26126 }
26127
26128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26129         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
26130         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
26131         return ret_conv;
26132 }
26133
26134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26135         if (!ptr_is_owned(_res)) return;
26136         void* _res_ptr = untag_ptr(_res);
26137         CHECK_ACCESS(_res_ptr);
26138         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
26139         FREE(untag_ptr(_res));
26140         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
26141 }
26142
26143 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
26144         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26145         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
26146         return tag_ptr(ret_conv, true);
26147 }
26148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26149         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
26150         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
26151         return ret_conv;
26152 }
26153
26154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26155         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
26156         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26157         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
26158         return tag_ptr(ret_conv, true);
26159 }
26160
26161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26162         LDKPhantomRouteHints o_conv;
26163         o_conv.inner = untag_ptr(o);
26164         o_conv.is_owned = ptr_is_owned(o);
26165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26166         o_conv = PhantomRouteHints_clone(&o_conv);
26167         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26168         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
26169         return tag_ptr(ret_conv, true);
26170 }
26171
26172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26173         void* e_ptr = untag_ptr(e);
26174         CHECK_ACCESS(e_ptr);
26175         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26176         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26177         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26178         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
26179         return tag_ptr(ret_conv, true);
26180 }
26181
26182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26183         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
26184         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
26185         return ret_conv;
26186 }
26187
26188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26189         if (!ptr_is_owned(_res)) return;
26190         void* _res_ptr = untag_ptr(_res);
26191         CHECK_ACCESS(_res_ptr);
26192         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
26193         FREE(untag_ptr(_res));
26194         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
26195 }
26196
26197 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
26198         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26199         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
26200         return tag_ptr(ret_conv, true);
26201 }
26202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26203         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
26204         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
26205         return ret_conv;
26206 }
26207
26208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26209         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
26210         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26211         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
26212         return tag_ptr(ret_conv, true);
26213 }
26214
26215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
26216         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
26217         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26218         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
26219         return tag_ptr(ret_conv, true);
26220 }
26221
26222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26223         void* e_ptr = untag_ptr(e);
26224         CHECK_ACCESS(e_ptr);
26225         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26226         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26227         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26228         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
26229         return tag_ptr(ret_conv, true);
26230 }
26231
26232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26233         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
26234         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
26235         return ret_conv;
26236 }
26237
26238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26239         if (!ptr_is_owned(_res)) return;
26240         void* _res_ptr = untag_ptr(_res);
26241         CHECK_ACCESS(_res_ptr);
26242         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
26243         FREE(untag_ptr(_res));
26244         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
26245 }
26246
26247 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
26248         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26249         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
26250         return tag_ptr(ret_conv, true);
26251 }
26252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26253         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
26254         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
26255         return ret_conv;
26256 }
26257
26258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26259         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
26260         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26261         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
26262         return tag_ptr(ret_conv, true);
26263 }
26264
26265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26266         LDKCVec_ChannelMonitorZ _res_constr;
26267         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26268         if (_res_constr.datalen > 0)
26269                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
26270         else
26271                 _res_constr.data = NULL;
26272         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26273         for (size_t q = 0; q < _res_constr.datalen; q++) {
26274                 int64_t _res_conv_16 = _res_vals[q];
26275                 LDKChannelMonitor _res_conv_16_conv;
26276                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26277                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26278                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26279                 _res_constr.data[q] = _res_conv_16_conv;
26280         }
26281         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26282         CVec_ChannelMonitorZ_free(_res_constr);
26283 }
26284
26285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
26286         LDKThirtyTwoBytes a_ref;
26287         CHECK((*env)->GetArrayLength(env, a) == 32);
26288         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26289         LDKChannelManager b_conv;
26290         b_conv.inner = untag_ptr(b);
26291         b_conv.is_owned = ptr_is_owned(b);
26292         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26293         // WARNING: we need a move here but no clone is available for LDKChannelManager
26294         
26295         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
26296         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
26297         return tag_ptr(ret_conv, true);
26298 }
26299
26300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26301         if (!ptr_is_owned(_res)) return;
26302         void* _res_ptr = untag_ptr(_res);
26303         CHECK_ACCESS(_res_ptr);
26304         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
26305         FREE(untag_ptr(_res));
26306         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
26307 }
26308
26309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26310         void* o_ptr = untag_ptr(o);
26311         CHECK_ACCESS(o_ptr);
26312         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
26313         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
26314         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
26315         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
26316         return tag_ptr(ret_conv, true);
26317 }
26318
26319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26320         void* e_ptr = untag_ptr(e);
26321         CHECK_ACCESS(e_ptr);
26322         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26323         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26324         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
26325         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
26326         return tag_ptr(ret_conv, true);
26327 }
26328
26329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26330         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
26331         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
26332         return ret_conv;
26333 }
26334
26335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26336         if (!ptr_is_owned(_res)) return;
26337         void* _res_ptr = untag_ptr(_res);
26338         CHECK_ACCESS(_res_ptr);
26339         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
26340         FREE(untag_ptr(_res));
26341         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
26342 }
26343
26344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26345         void* o_ptr = untag_ptr(o);
26346         CHECK_ACCESS(o_ptr);
26347         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
26348         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
26349         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26350         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
26351         return tag_ptr(ret_conv, true);
26352 }
26353
26354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26355         void* e_ptr = untag_ptr(e);
26356         CHECK_ACCESS(e_ptr);
26357         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26358         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26359         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26360         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
26361         return tag_ptr(ret_conv, true);
26362 }
26363
26364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26365         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
26366         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
26367         return ret_conv;
26368 }
26369
26370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26371         if (!ptr_is_owned(_res)) return;
26372         void* _res_ptr = untag_ptr(_res);
26373         CHECK_ACCESS(_res_ptr);
26374         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
26375         FREE(untag_ptr(_res));
26376         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
26377 }
26378
26379 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
26380         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26381         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
26382         return tag_ptr(ret_conv, true);
26383 }
26384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26385         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
26386         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
26387         return ret_conv;
26388 }
26389
26390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26391         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
26392         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26393         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
26394         return tag_ptr(ret_conv, true);
26395 }
26396
26397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26398         LDKChannelConfig o_conv;
26399         o_conv.inner = untag_ptr(o);
26400         o_conv.is_owned = ptr_is_owned(o);
26401         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26402         o_conv = ChannelConfig_clone(&o_conv);
26403         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26404         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
26405         return tag_ptr(ret_conv, true);
26406 }
26407
26408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26409         void* e_ptr = untag_ptr(e);
26410         CHECK_ACCESS(e_ptr);
26411         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26412         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26413         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26414         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
26415         return tag_ptr(ret_conv, true);
26416 }
26417
26418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26419         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
26420         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
26421         return ret_conv;
26422 }
26423
26424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26425         if (!ptr_is_owned(_res)) return;
26426         void* _res_ptr = untag_ptr(_res);
26427         CHECK_ACCESS(_res_ptr);
26428         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
26429         FREE(untag_ptr(_res));
26430         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
26431 }
26432
26433 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
26434         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26435         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
26436         return tag_ptr(ret_conv, true);
26437 }
26438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26439         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
26440         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
26441         return ret_conv;
26442 }
26443
26444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26445         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
26446         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26447         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
26448         return tag_ptr(ret_conv, true);
26449 }
26450
26451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26452         void* o_ptr = untag_ptr(o);
26453         CHECK_ACCESS(o_ptr);
26454         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
26455         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
26456         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26457         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
26458         int64_t ret_ref = tag_ptr(ret_copy, true);
26459         return ret_ref;
26460 }
26461
26462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
26463         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26464         *ret_copy = COption_MaxDustHTLCExposureZ_none();
26465         int64_t ret_ref = tag_ptr(ret_copy, true);
26466         return ret_ref;
26467 }
26468
26469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26470         if (!ptr_is_owned(_res)) return;
26471         void* _res_ptr = untag_ptr(_res);
26472         CHECK_ACCESS(_res_ptr);
26473         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
26474         FREE(untag_ptr(_res));
26475         COption_MaxDustHTLCExposureZ_free(_res_conv);
26476 }
26477
26478 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
26479         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26480         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
26481         int64_t ret_ref = tag_ptr(ret_copy, true);
26482         return ret_ref;
26483 }
26484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26485         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
26486         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
26487         return ret_conv;
26488 }
26489
26490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26491         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
26492         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26493         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
26494         int64_t ret_ref = tag_ptr(ret_copy, true);
26495         return ret_ref;
26496 }
26497
26498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26499         void* o_ptr = untag_ptr(o);
26500         CHECK_ACCESS(o_ptr);
26501         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
26502         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
26503         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
26504         *ret_copy = COption_APIErrorZ_some(o_conv);
26505         int64_t ret_ref = tag_ptr(ret_copy, true);
26506         return ret_ref;
26507 }
26508
26509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
26510         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
26511         *ret_copy = COption_APIErrorZ_none();
26512         int64_t ret_ref = tag_ptr(ret_copy, true);
26513         return ret_ref;
26514 }
26515
26516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26517         if (!ptr_is_owned(_res)) return;
26518         void* _res_ptr = untag_ptr(_res);
26519         CHECK_ACCESS(_res_ptr);
26520         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
26521         FREE(untag_ptr(_res));
26522         COption_APIErrorZ_free(_res_conv);
26523 }
26524
26525 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
26526         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
26527         *ret_copy = COption_APIErrorZ_clone(arg);
26528         int64_t ret_ref = tag_ptr(ret_copy, true);
26529         return ret_ref;
26530 }
26531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26532         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
26533         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
26534         return ret_conv;
26535 }
26536
26537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26538         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
26539         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
26540         *ret_copy = COption_APIErrorZ_clone(orig_conv);
26541         int64_t ret_ref = tag_ptr(ret_copy, true);
26542         return ret_ref;
26543 }
26544
26545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26546         void* o_ptr = untag_ptr(o);
26547         CHECK_ACCESS(o_ptr);
26548         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
26549         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
26550         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
26551         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
26552         return tag_ptr(ret_conv, true);
26553 }
26554
26555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26556         void* e_ptr = untag_ptr(e);
26557         CHECK_ACCESS(e_ptr);
26558         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26559         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26560         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
26561         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
26562         return tag_ptr(ret_conv, true);
26563 }
26564
26565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26566         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
26567         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
26568         return ret_conv;
26569 }
26570
26571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26572         if (!ptr_is_owned(_res)) return;
26573         void* _res_ptr = untag_ptr(_res);
26574         CHECK_ACCESS(_res_ptr);
26575         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
26576         FREE(untag_ptr(_res));
26577         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
26578 }
26579
26580 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
26581         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
26582         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
26583         return tag_ptr(ret_conv, true);
26584 }
26585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26586         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
26587         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
26588         return ret_conv;
26589 }
26590
26591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26592         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
26593         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
26594         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
26595         return tag_ptr(ret_conv, true);
26596 }
26597
26598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26599         LDKChannelMonitorUpdate o_conv;
26600         o_conv.inner = untag_ptr(o);
26601         o_conv.is_owned = ptr_is_owned(o);
26602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26603         o_conv = ChannelMonitorUpdate_clone(&o_conv);
26604         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26605         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
26606         return tag_ptr(ret_conv, true);
26607 }
26608
26609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26610         void* e_ptr = untag_ptr(e);
26611         CHECK_ACCESS(e_ptr);
26612         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26613         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26614         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26615         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
26616         return tag_ptr(ret_conv, true);
26617 }
26618
26619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26620         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
26621         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
26622         return ret_conv;
26623 }
26624
26625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26626         if (!ptr_is_owned(_res)) return;
26627         void* _res_ptr = untag_ptr(_res);
26628         CHECK_ACCESS(_res_ptr);
26629         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
26630         FREE(untag_ptr(_res));
26631         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
26632 }
26633
26634 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
26635         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26636         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
26637         return tag_ptr(ret_conv, true);
26638 }
26639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26640         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
26641         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
26642         return ret_conv;
26643 }
26644
26645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26646         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
26647         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26648         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
26649         return tag_ptr(ret_conv, true);
26650 }
26651
26652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26653         void* o_ptr = untag_ptr(o);
26654         CHECK_ACCESS(o_ptr);
26655         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
26656         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
26657         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
26658         *ret_copy = COption_MonitorEventZ_some(o_conv);
26659         int64_t ret_ref = tag_ptr(ret_copy, true);
26660         return ret_ref;
26661 }
26662
26663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
26664         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
26665         *ret_copy = COption_MonitorEventZ_none();
26666         int64_t ret_ref = tag_ptr(ret_copy, true);
26667         return ret_ref;
26668 }
26669
26670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26671         if (!ptr_is_owned(_res)) return;
26672         void* _res_ptr = untag_ptr(_res);
26673         CHECK_ACCESS(_res_ptr);
26674         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
26675         FREE(untag_ptr(_res));
26676         COption_MonitorEventZ_free(_res_conv);
26677 }
26678
26679 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
26680         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
26681         *ret_copy = COption_MonitorEventZ_clone(arg);
26682         int64_t ret_ref = tag_ptr(ret_copy, true);
26683         return ret_ref;
26684 }
26685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26686         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
26687         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
26688         return ret_conv;
26689 }
26690
26691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26692         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
26693         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
26694         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
26695         int64_t ret_ref = tag_ptr(ret_copy, true);
26696         return ret_ref;
26697 }
26698
26699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26700         void* o_ptr = untag_ptr(o);
26701         CHECK_ACCESS(o_ptr);
26702         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
26703         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
26704         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26705         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
26706         return tag_ptr(ret_conv, true);
26707 }
26708
26709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26710         void* e_ptr = untag_ptr(e);
26711         CHECK_ACCESS(e_ptr);
26712         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26713         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26714         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26715         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
26716         return tag_ptr(ret_conv, true);
26717 }
26718
26719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26720         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
26721         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
26722         return ret_conv;
26723 }
26724
26725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26726         if (!ptr_is_owned(_res)) return;
26727         void* _res_ptr = untag_ptr(_res);
26728         CHECK_ACCESS(_res_ptr);
26729         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
26730         FREE(untag_ptr(_res));
26731         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
26732 }
26733
26734 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
26735         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26736         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
26737         return tag_ptr(ret_conv, true);
26738 }
26739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26740         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
26741         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
26742         return ret_conv;
26743 }
26744
26745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26746         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
26747         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26748         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
26749         return tag_ptr(ret_conv, true);
26750 }
26751
26752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26753         LDKHTLCUpdate o_conv;
26754         o_conv.inner = untag_ptr(o);
26755         o_conv.is_owned = ptr_is_owned(o);
26756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26757         o_conv = HTLCUpdate_clone(&o_conv);
26758         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26759         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
26760         return tag_ptr(ret_conv, true);
26761 }
26762
26763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26764         void* e_ptr = untag_ptr(e);
26765         CHECK_ACCESS(e_ptr);
26766         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26767         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26768         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26769         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
26770         return tag_ptr(ret_conv, true);
26771 }
26772
26773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26774         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
26775         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
26776         return ret_conv;
26777 }
26778
26779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26780         if (!ptr_is_owned(_res)) return;
26781         void* _res_ptr = untag_ptr(_res);
26782         CHECK_ACCESS(_res_ptr);
26783         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
26784         FREE(untag_ptr(_res));
26785         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
26786 }
26787
26788 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
26789         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26790         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
26791         return tag_ptr(ret_conv, true);
26792 }
26793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26794         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
26795         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
26796         return ret_conv;
26797 }
26798
26799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26800         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
26801         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26802         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
26803         return tag_ptr(ret_conv, true);
26804 }
26805
26806 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
26807         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
26808         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
26809         return tag_ptr(ret_conv, true);
26810 }
26811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26812         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
26813         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
26814         return ret_conv;
26815 }
26816
26817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26818         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
26819         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
26820         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
26821         return tag_ptr(ret_conv, true);
26822 }
26823
26824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
26825         LDKOutPoint a_conv;
26826         a_conv.inner = untag_ptr(a);
26827         a_conv.is_owned = ptr_is_owned(a);
26828         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26829         a_conv = OutPoint_clone(&a_conv);
26830         LDKCVec_u8Z b_ref;
26831         b_ref.datalen = (*env)->GetArrayLength(env, b);
26832         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
26833         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
26834         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
26835         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
26836         return tag_ptr(ret_conv, true);
26837 }
26838
26839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26840         if (!ptr_is_owned(_res)) return;
26841         void* _res_ptr = untag_ptr(_res);
26842         CHECK_ACCESS(_res_ptr);
26843         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
26844         FREE(untag_ptr(_res));
26845         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
26846 }
26847
26848 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
26849         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26850         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
26851         return tag_ptr(ret_conv, true);
26852 }
26853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26854         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
26855         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
26856         return ret_conv;
26857 }
26858
26859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26860         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
26861         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26862         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
26863         return tag_ptr(ret_conv, true);
26864 }
26865
26866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
26867         LDKCVec_u8Z b_ref;
26868         b_ref.datalen = (*env)->GetArrayLength(env, b);
26869         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
26870         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
26871         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26872         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
26873         return tag_ptr(ret_conv, true);
26874 }
26875
26876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26877         if (!ptr_is_owned(_res)) return;
26878         void* _res_ptr = untag_ptr(_res);
26879         CHECK_ACCESS(_res_ptr);
26880         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
26881         FREE(untag_ptr(_res));
26882         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
26883 }
26884
26885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26886         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
26887         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26888         if (_res_constr.datalen > 0)
26889                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
26890         else
26891                 _res_constr.data = NULL;
26892         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26893         for (size_t x = 0; x < _res_constr.datalen; x++) {
26894                 int64_t _res_conv_23 = _res_vals[x];
26895                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
26896                 CHECK_ACCESS(_res_conv_23_ptr);
26897                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
26898                 FREE(untag_ptr(_res_conv_23));
26899                 _res_constr.data[x] = _res_conv_23_conv;
26900         }
26901         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26902         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
26903 }
26904
26905 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
26906         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26907         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
26908         return tag_ptr(ret_conv, true);
26909 }
26910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26911         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
26912         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
26913         return ret_conv;
26914 }
26915
26916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26917         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
26918         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26919         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
26920         return tag_ptr(ret_conv, true);
26921 }
26922
26923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
26924         LDKThirtyTwoBytes a_ref;
26925         CHECK((*env)->GetArrayLength(env, a) == 32);
26926         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26927         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
26928         b_constr.datalen = (*env)->GetArrayLength(env, b);
26929         if (b_constr.datalen > 0)
26930                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
26931         else
26932                 b_constr.data = NULL;
26933         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
26934         for (size_t x = 0; x < b_constr.datalen; x++) {
26935                 int64_t b_conv_23 = b_vals[x];
26936                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
26937                 CHECK_ACCESS(b_conv_23_ptr);
26938                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
26939                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
26940                 b_constr.data[x] = b_conv_23_conv;
26941         }
26942         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
26943         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26944         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
26945         return tag_ptr(ret_conv, true);
26946 }
26947
26948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26949         if (!ptr_is_owned(_res)) return;
26950         void* _res_ptr = untag_ptr(_res);
26951         CHECK_ACCESS(_res_ptr);
26952         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
26953         FREE(untag_ptr(_res));
26954         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
26955 }
26956
26957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26958         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
26959         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26960         if (_res_constr.datalen > 0)
26961                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
26962         else
26963                 _res_constr.data = NULL;
26964         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26965         for (size_t a = 0; a < _res_constr.datalen; a++) {
26966                 int64_t _res_conv_52 = _res_vals[a];
26967                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
26968                 CHECK_ACCESS(_res_conv_52_ptr);
26969                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
26970                 FREE(untag_ptr(_res_conv_52));
26971                 _res_constr.data[a] = _res_conv_52_conv;
26972         }
26973         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26974         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
26975 }
26976
26977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CommitmentTransactionZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26978         LDKCVec_CommitmentTransactionZ _res_constr;
26979         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26980         if (_res_constr.datalen > 0)
26981                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
26982         else
26983                 _res_constr.data = NULL;
26984         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26985         for (size_t x = 0; x < _res_constr.datalen; x++) {
26986                 int64_t _res_conv_23 = _res_vals[x];
26987                 LDKCommitmentTransaction _res_conv_23_conv;
26988                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
26989                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
26990                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
26991                 _res_constr.data[x] = _res_conv_23_conv;
26992         }
26993         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26994         CVec_CommitmentTransactionZ_free(_res_constr);
26995 }
26996
26997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
26998         LDKCVec_TransactionZ _res_constr;
26999         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27000         if (_res_constr.datalen > 0)
27001                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
27002         else
27003                 _res_constr.data = NULL;
27004         for (size_t i = 0; i < _res_constr.datalen; i++) {
27005                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
27006                 LDKTransaction _res_conv_8_ref;
27007                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
27008                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
27009                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
27010                 _res_conv_8_ref.data_is_owned = true;
27011                 _res_constr.data[i] = _res_conv_8_ref;
27012         }
27013         CVec_TransactionZ_free(_res_constr);
27014 }
27015
27016 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
27017         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27018         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
27019         return tag_ptr(ret_conv, true);
27020 }
27021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27022         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
27023         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
27024         return ret_conv;
27025 }
27026
27027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27028         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
27029         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27030         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
27031         return tag_ptr(ret_conv, true);
27032 }
27033
27034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
27035         void* b_ptr = untag_ptr(b);
27036         CHECK_ACCESS(b_ptr);
27037         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
27038         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
27039         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27040         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
27041         return tag_ptr(ret_conv, true);
27042 }
27043
27044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27045         if (!ptr_is_owned(_res)) return;
27046         void* _res_ptr = untag_ptr(_res);
27047         CHECK_ACCESS(_res_ptr);
27048         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
27049         FREE(untag_ptr(_res));
27050         C2Tuple_u32TxOutZ_free(_res_conv);
27051 }
27052
27053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27054         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
27055         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27056         if (_res_constr.datalen > 0)
27057                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
27058         else
27059                 _res_constr.data = NULL;
27060         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27061         for (size_t u = 0; u < _res_constr.datalen; u++) {
27062                 int64_t _res_conv_20 = _res_vals[u];
27063                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
27064                 CHECK_ACCESS(_res_conv_20_ptr);
27065                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
27066                 FREE(untag_ptr(_res_conv_20));
27067                 _res_constr.data[u] = _res_conv_20_conv;
27068         }
27069         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27070         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
27071 }
27072
27073 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
27074         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27075         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
27076         return tag_ptr(ret_conv, true);
27077 }
27078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27079         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
27080         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
27081         return ret_conv;
27082 }
27083
27084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27085         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
27086         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27087         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
27088         return tag_ptr(ret_conv, true);
27089 }
27090
27091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
27092         LDKThirtyTwoBytes a_ref;
27093         CHECK((*env)->GetArrayLength(env, a) == 32);
27094         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27095         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
27096         b_constr.datalen = (*env)->GetArrayLength(env, b);
27097         if (b_constr.datalen > 0)
27098                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
27099         else
27100                 b_constr.data = NULL;
27101         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
27102         for (size_t u = 0; u < b_constr.datalen; u++) {
27103                 int64_t b_conv_20 = b_vals[u];
27104                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
27105                 CHECK_ACCESS(b_conv_20_ptr);
27106                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
27107                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
27108                 b_constr.data[u] = b_conv_20_conv;
27109         }
27110         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
27111         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27112         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
27113         return tag_ptr(ret_conv, true);
27114 }
27115
27116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27117         if (!ptr_is_owned(_res)) return;
27118         void* _res_ptr = untag_ptr(_res);
27119         CHECK_ACCESS(_res_ptr);
27120         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
27121         FREE(untag_ptr(_res));
27122         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
27123 }
27124
27125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27126         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
27127         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27128         if (_res_constr.datalen > 0)
27129                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
27130         else
27131                 _res_constr.data = NULL;
27132         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27133         for (size_t x = 0; x < _res_constr.datalen; x++) {
27134                 int64_t _res_conv_49 = _res_vals[x];
27135                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
27136                 CHECK_ACCESS(_res_conv_49_ptr);
27137                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
27138                 FREE(untag_ptr(_res_conv_49));
27139                 _res_constr.data[x] = _res_conv_49_conv;
27140         }
27141         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27142         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
27143 }
27144
27145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27146         LDKCVec_BalanceZ _res_constr;
27147         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27148         if (_res_constr.datalen > 0)
27149                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
27150         else
27151                 _res_constr.data = NULL;
27152         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27153         for (size_t j = 0; j < _res_constr.datalen; j++) {
27154                 int64_t _res_conv_9 = _res_vals[j];
27155                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
27156                 CHECK_ACCESS(_res_conv_9_ptr);
27157                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
27158                 FREE(untag_ptr(_res_conv_9));
27159                 _res_constr.data[j] = _res_conv_9_conv;
27160         }
27161         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27162         CVec_BalanceZ_free(_res_constr);
27163 }
27164
27165 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
27166         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27167         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
27168         return tag_ptr(ret_conv, true);
27169 }
27170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27171         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
27172         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
27173         return ret_conv;
27174 }
27175
27176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27177         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
27178         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27179         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
27180         return tag_ptr(ret_conv, true);
27181 }
27182
27183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27184         LDKThirtyTwoBytes a_ref;
27185         CHECK((*env)->GetArrayLength(env, a) == 32);
27186         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27187         LDKChannelMonitor b_conv;
27188         b_conv.inner = untag_ptr(b);
27189         b_conv.is_owned = ptr_is_owned(b);
27190         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27191         b_conv = ChannelMonitor_clone(&b_conv);
27192         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27193         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
27194         return tag_ptr(ret_conv, true);
27195 }
27196
27197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27198         if (!ptr_is_owned(_res)) return;
27199         void* _res_ptr = untag_ptr(_res);
27200         CHECK_ACCESS(_res_ptr);
27201         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
27202         FREE(untag_ptr(_res));
27203         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
27204 }
27205
27206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27207         void* o_ptr = untag_ptr(o);
27208         CHECK_ACCESS(o_ptr);
27209         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
27210         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
27211         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27212         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
27213         return tag_ptr(ret_conv, true);
27214 }
27215
27216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27217         void* e_ptr = untag_ptr(e);
27218         CHECK_ACCESS(e_ptr);
27219         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27220         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27221         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27222         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
27223         return tag_ptr(ret_conv, true);
27224 }
27225
27226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27227         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
27228         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
27229         return ret_conv;
27230 }
27231
27232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27233         if (!ptr_is_owned(_res)) return;
27234         void* _res_ptr = untag_ptr(_res);
27235         CHECK_ACCESS(_res_ptr);
27236         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
27237         FREE(untag_ptr(_res));
27238         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
27239 }
27240
27241 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
27242         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27243         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
27244         return tag_ptr(ret_conv, true);
27245 }
27246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27247         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
27248         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
27249         return ret_conv;
27250 }
27251
27252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27253         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
27254         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27255         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
27256         return tag_ptr(ret_conv, true);
27257 }
27258
27259 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
27260         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27261         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
27262         return tag_ptr(ret_conv, true);
27263 }
27264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27265         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
27266         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
27267         return ret_conv;
27268 }
27269
27270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27271         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
27272         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27273         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
27274         return tag_ptr(ret_conv, true);
27275 }
27276
27277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27278         LDKPublicKey a_ref;
27279         CHECK((*env)->GetArrayLength(env, a) == 33);
27280         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
27281         void* b_ptr = untag_ptr(b);
27282         CHECK_ACCESS(b_ptr);
27283         LDKType b_conv = *(LDKType*)(b_ptr);
27284         if (b_conv.free == LDKType_JCalls_free) {
27285                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27286                 LDKType_JCalls_cloned(&b_conv);
27287         }
27288         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27289         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
27290         return tag_ptr(ret_conv, true);
27291 }
27292
27293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27294         if (!ptr_is_owned(_res)) return;
27295         void* _res_ptr = untag_ptr(_res);
27296         CHECK_ACCESS(_res_ptr);
27297         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
27298         FREE(untag_ptr(_res));
27299         C2Tuple_PublicKeyTypeZ_free(_res_conv);
27300 }
27301
27302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27303         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
27304         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27305         if (_res_constr.datalen > 0)
27306                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
27307         else
27308                 _res_constr.data = NULL;
27309         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27310         for (size_t z = 0; z < _res_constr.datalen; z++) {
27311                 int64_t _res_conv_25 = _res_vals[z];
27312                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
27313                 CHECK_ACCESS(_res_conv_25_ptr);
27314                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
27315                 FREE(untag_ptr(_res_conv_25));
27316                 _res_constr.data[z] = _res_conv_25_conv;
27317         }
27318         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27319         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
27320 }
27321
27322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27323         void* o_ptr = untag_ptr(o);
27324         CHECK_ACCESS(o_ptr);
27325         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
27326         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
27327         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27328         *ret_copy = COption_OffersMessageZ_some(o_conv);
27329         int64_t ret_ref = tag_ptr(ret_copy, true);
27330         return ret_ref;
27331 }
27332
27333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
27334         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27335         *ret_copy = COption_OffersMessageZ_none();
27336         int64_t ret_ref = tag_ptr(ret_copy, true);
27337         return ret_ref;
27338 }
27339
27340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27341         if (!ptr_is_owned(_res)) return;
27342         void* _res_ptr = untag_ptr(_res);
27343         CHECK_ACCESS(_res_ptr);
27344         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
27345         FREE(untag_ptr(_res));
27346         COption_OffersMessageZ_free(_res_conv);
27347 }
27348
27349 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
27350         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27351         *ret_copy = COption_OffersMessageZ_clone(arg);
27352         int64_t ret_ref = tag_ptr(ret_copy, true);
27353         return ret_ref;
27354 }
27355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27356         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
27357         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
27358         return ret_conv;
27359 }
27360
27361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27362         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
27363         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27364         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
27365         int64_t ret_ref = tag_ptr(ret_copy, true);
27366         return ret_ref;
27367 }
27368
27369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27370         void* o_ptr = untag_ptr(o);
27371         CHECK_ACCESS(o_ptr);
27372         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
27373         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
27374                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27375                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
27376         }
27377         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
27378         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
27379         int64_t ret_ref = tag_ptr(ret_copy, true);
27380         return ret_ref;
27381 }
27382
27383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
27384         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
27385         *ret_copy = COption_CustomOnionMessageContentsZ_none();
27386         int64_t ret_ref = tag_ptr(ret_copy, true);
27387         return ret_ref;
27388 }
27389
27390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27391         if (!ptr_is_owned(_res)) return;
27392         void* _res_ptr = untag_ptr(_res);
27393         CHECK_ACCESS(_res_ptr);
27394         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
27395         FREE(untag_ptr(_res));
27396         COption_CustomOnionMessageContentsZ_free(_res_conv);
27397 }
27398
27399 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
27400         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
27401         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
27402         int64_t ret_ref = tag_ptr(ret_copy, true);
27403         return ret_ref;
27404 }
27405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27406         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
27407         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
27408         return ret_conv;
27409 }
27410
27411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27412         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
27413         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
27414         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
27415         int64_t ret_ref = tag_ptr(ret_copy, true);
27416         return ret_ref;
27417 }
27418
27419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27420         void* o_ptr = untag_ptr(o);
27421         CHECK_ACCESS(o_ptr);
27422         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
27423         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
27424         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
27425         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
27426         return tag_ptr(ret_conv, true);
27427 }
27428
27429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27430         void* e_ptr = untag_ptr(e);
27431         CHECK_ACCESS(e_ptr);
27432         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27433         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27434         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
27435         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
27436         return tag_ptr(ret_conv, true);
27437 }
27438
27439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27440         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
27441         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
27442         return ret_conv;
27443 }
27444
27445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27446         if (!ptr_is_owned(_res)) return;
27447         void* _res_ptr = untag_ptr(_res);
27448         CHECK_ACCESS(_res_ptr);
27449         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
27450         FREE(untag_ptr(_res));
27451         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
27452 }
27453
27454 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
27455         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
27456         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
27457         return tag_ptr(ret_conv, true);
27458 }
27459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27460         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
27461         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
27462         return ret_conv;
27463 }
27464
27465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27466         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
27467         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
27468         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
27469         return tag_ptr(ret_conv, true);
27470 }
27471
27472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27473         void* o_ptr = untag_ptr(o);
27474         CHECK_ACCESS(o_ptr);
27475         LDKType o_conv = *(LDKType*)(o_ptr);
27476         if (o_conv.free == LDKType_JCalls_free) {
27477                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27478                 LDKType_JCalls_cloned(&o_conv);
27479         }
27480         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
27481         *ret_copy = COption_TypeZ_some(o_conv);
27482         int64_t ret_ref = tag_ptr(ret_copy, true);
27483         return ret_ref;
27484 }
27485
27486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
27487         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
27488         *ret_copy = COption_TypeZ_none();
27489         int64_t ret_ref = tag_ptr(ret_copy, true);
27490         return ret_ref;
27491 }
27492
27493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27494         if (!ptr_is_owned(_res)) return;
27495         void* _res_ptr = untag_ptr(_res);
27496         CHECK_ACCESS(_res_ptr);
27497         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
27498         FREE(untag_ptr(_res));
27499         COption_TypeZ_free(_res_conv);
27500 }
27501
27502 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
27503         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
27504         *ret_copy = COption_TypeZ_clone(arg);
27505         int64_t ret_ref = tag_ptr(ret_copy, true);
27506         return ret_ref;
27507 }
27508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27509         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
27510         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
27511         return ret_conv;
27512 }
27513
27514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27515         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
27516         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
27517         *ret_copy = COption_TypeZ_clone(orig_conv);
27518         int64_t ret_ref = tag_ptr(ret_copy, true);
27519         return ret_ref;
27520 }
27521
27522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27523         void* o_ptr = untag_ptr(o);
27524         CHECK_ACCESS(o_ptr);
27525         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
27526         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
27527         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
27528         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
27529         return tag_ptr(ret_conv, true);
27530 }
27531
27532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27533         void* e_ptr = untag_ptr(e);
27534         CHECK_ACCESS(e_ptr);
27535         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27536         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27537         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
27538         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
27539         return tag_ptr(ret_conv, true);
27540 }
27541
27542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27543         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
27544         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
27545         return ret_conv;
27546 }
27547
27548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27549         if (!ptr_is_owned(_res)) return;
27550         void* _res_ptr = untag_ptr(_res);
27551         CHECK_ACCESS(_res_ptr);
27552         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
27553         FREE(untag_ptr(_res));
27554         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
27555 }
27556
27557 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
27558         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
27559         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
27560         return tag_ptr(ret_conv, true);
27561 }
27562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27563         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
27564         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
27565         return ret_conv;
27566 }
27567
27568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27569         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
27570         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
27571         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
27572         return tag_ptr(ret_conv, true);
27573 }
27574
27575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27576         void* o_ptr = untag_ptr(o);
27577         CHECK_ACCESS(o_ptr);
27578         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27579         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27580         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
27581         *ret_copy = COption_SocketAddressZ_some(o_conv);
27582         int64_t ret_ref = tag_ptr(ret_copy, true);
27583         return ret_ref;
27584 }
27585
27586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1none(JNIEnv *env, jclass clz) {
27587         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
27588         *ret_copy = COption_SocketAddressZ_none();
27589         int64_t ret_ref = tag_ptr(ret_copy, true);
27590         return ret_ref;
27591 }
27592
27593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27594         if (!ptr_is_owned(_res)) return;
27595         void* _res_ptr = untag_ptr(_res);
27596         CHECK_ACCESS(_res_ptr);
27597         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
27598         FREE(untag_ptr(_res));
27599         COption_SocketAddressZ_free(_res_conv);
27600 }
27601
27602 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
27603         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
27604         *ret_copy = COption_SocketAddressZ_clone(arg);
27605         int64_t ret_ref = tag_ptr(ret_copy, true);
27606         return ret_ref;
27607 }
27608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27609         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
27610         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
27611         return ret_conv;
27612 }
27613
27614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27615         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
27616         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
27617         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
27618         int64_t ret_ref = tag_ptr(ret_copy, true);
27619         return ret_ref;
27620 }
27621
27622 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
27623         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
27624         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
27625         return tag_ptr(ret_conv, true);
27626 }
27627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27628         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
27629         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
27630         return ret_conv;
27631 }
27632
27633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27634         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
27635         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
27636         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
27637         return tag_ptr(ret_conv, true);
27638 }
27639
27640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27641         LDKPublicKey a_ref;
27642         CHECK((*env)->GetArrayLength(env, a) == 33);
27643         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
27644         void* b_ptr = untag_ptr(b);
27645         CHECK_ACCESS(b_ptr);
27646         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
27647         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
27648         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
27649         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
27650         return tag_ptr(ret_conv, true);
27651 }
27652
27653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27654         if (!ptr_is_owned(_res)) return;
27655         void* _res_ptr = untag_ptr(_res);
27656         CHECK_ACCESS(_res_ptr);
27657         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
27658         FREE(untag_ptr(_res));
27659         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
27660 }
27661
27662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27663         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
27664         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27665         if (_res_constr.datalen > 0)
27666                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
27667         else
27668                 _res_constr.data = NULL;
27669         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27670         for (size_t r = 0; r < _res_constr.datalen; r++) {
27671                 int64_t _res_conv_43 = _res_vals[r];
27672                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
27673                 CHECK_ACCESS(_res_conv_43_ptr);
27674                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
27675                 FREE(untag_ptr(_res_conv_43));
27676                 _res_constr.data[r] = _res_conv_43_conv;
27677         }
27678         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27679         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
27680 }
27681
27682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27683         LDKCVec_u8Z o_ref;
27684         o_ref.datalen = (*env)->GetArrayLength(env, o);
27685         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
27686         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
27687         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27688         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
27689         return tag_ptr(ret_conv, true);
27690 }
27691
27692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27693         LDKPeerHandleError e_conv;
27694         e_conv.inner = untag_ptr(e);
27695         e_conv.is_owned = ptr_is_owned(e);
27696         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
27697         e_conv = PeerHandleError_clone(&e_conv);
27698         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27699         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
27700         return tag_ptr(ret_conv, true);
27701 }
27702
27703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27704         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
27705         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
27706         return ret_conv;
27707 }
27708
27709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27710         if (!ptr_is_owned(_res)) return;
27711         void* _res_ptr = untag_ptr(_res);
27712         CHECK_ACCESS(_res_ptr);
27713         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
27714         FREE(untag_ptr(_res));
27715         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
27716 }
27717
27718 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
27719         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27720         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
27721         return tag_ptr(ret_conv, true);
27722 }
27723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27724         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
27725         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
27726         return ret_conv;
27727 }
27728
27729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27730         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
27731         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27732         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
27733         return tag_ptr(ret_conv, true);
27734 }
27735
27736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
27737         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27738         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
27739         return tag_ptr(ret_conv, true);
27740 }
27741
27742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27743         LDKPeerHandleError e_conv;
27744         e_conv.inner = untag_ptr(e);
27745         e_conv.is_owned = ptr_is_owned(e);
27746         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
27747         e_conv = PeerHandleError_clone(&e_conv);
27748         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27749         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
27750         return tag_ptr(ret_conv, true);
27751 }
27752
27753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27754         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
27755         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
27756         return ret_conv;
27757 }
27758
27759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27760         if (!ptr_is_owned(_res)) return;
27761         void* _res_ptr = untag_ptr(_res);
27762         CHECK_ACCESS(_res_ptr);
27763         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
27764         FREE(untag_ptr(_res));
27765         CResult_NonePeerHandleErrorZ_free(_res_conv);
27766 }
27767
27768 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
27769         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27770         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
27771         return tag_ptr(ret_conv, true);
27772 }
27773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27774         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
27775         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
27776         return ret_conv;
27777 }
27778
27779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27780         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
27781         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27782         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
27783         return tag_ptr(ret_conv, true);
27784 }
27785
27786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
27787         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27788         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
27789         return tag_ptr(ret_conv, true);
27790 }
27791
27792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27793         LDKPeerHandleError e_conv;
27794         e_conv.inner = untag_ptr(e);
27795         e_conv.is_owned = ptr_is_owned(e);
27796         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
27797         e_conv = PeerHandleError_clone(&e_conv);
27798         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27799         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
27800         return tag_ptr(ret_conv, true);
27801 }
27802
27803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27804         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
27805         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
27806         return ret_conv;
27807 }
27808
27809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27810         if (!ptr_is_owned(_res)) return;
27811         void* _res_ptr = untag_ptr(_res);
27812         CHECK_ACCESS(_res_ptr);
27813         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
27814         FREE(untag_ptr(_res));
27815         CResult_boolPeerHandleErrorZ_free(_res_conv);
27816 }
27817
27818 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
27819         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27820         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
27821         return tag_ptr(ret_conv, true);
27822 }
27823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27824         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
27825         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
27826         return ret_conv;
27827 }
27828
27829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27830         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
27831         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27832         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
27833         return tag_ptr(ret_conv, true);
27834 }
27835
27836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
27837         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
27838         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
27839         return tag_ptr(ret_conv, true);
27840 }
27841
27842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27843         void* e_ptr = untag_ptr(e);
27844         CHECK_ACCESS(e_ptr);
27845         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
27846         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
27847         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
27848         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
27849         return tag_ptr(ret_conv, true);
27850 }
27851
27852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27853         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
27854         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
27855         return ret_conv;
27856 }
27857
27858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27859         if (!ptr_is_owned(_res)) return;
27860         void* _res_ptr = untag_ptr(_res);
27861         CHECK_ACCESS(_res_ptr);
27862         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
27863         FREE(untag_ptr(_res));
27864         CResult_u32GraphSyncErrorZ_free(_res_conv);
27865 }
27866
27867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27868         LDKCVec_u8Z o_ref;
27869         o_ref.datalen = (*env)->GetArrayLength(env, o);
27870         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
27871         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
27872         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27873         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
27874         return tag_ptr(ret_conv, true);
27875 }
27876
27877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
27878         LDKIOError e_conv = LDKIOError_from_java(env, e);
27879         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27880         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
27881         return tag_ptr(ret_conv, true);
27882 }
27883
27884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27885         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
27886         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
27887         return ret_conv;
27888 }
27889
27890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27891         if (!ptr_is_owned(_res)) return;
27892         void* _res_ptr = untag_ptr(_res);
27893         CHECK_ACCESS(_res_ptr);
27894         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
27895         FREE(untag_ptr(_res));
27896         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
27897 }
27898
27899 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
27900         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27901         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
27902         return tag_ptr(ret_conv, true);
27903 }
27904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27905         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
27906         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
27907         return ret_conv;
27908 }
27909
27910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27911         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
27912         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27913         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
27914         return tag_ptr(ret_conv, true);
27915 }
27916
27917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1StrZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
27918         LDKCVec_StrZ _res_constr;
27919         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27920         if (_res_constr.datalen > 0)
27921                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
27922         else
27923                 _res_constr.data = NULL;
27924         for (size_t i = 0; i < _res_constr.datalen; i++) {
27925                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
27926                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
27927                 _res_constr.data[i] = dummy;
27928         }
27929         CVec_StrZ_free(_res_constr);
27930 }
27931
27932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
27933         LDKCVec_StrZ o_constr;
27934         o_constr.datalen = (*env)->GetArrayLength(env, o);
27935         if (o_constr.datalen > 0)
27936                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
27937         else
27938                 o_constr.data = NULL;
27939         for (size_t i = 0; i < o_constr.datalen; i++) {
27940                 jstring o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
27941                 LDKStr o_conv_8_conv = java_to_owned_str(env, o_conv_8);
27942                 o_constr.data[i] = o_conv_8_conv;
27943         }
27944         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27945         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
27946         return tag_ptr(ret_conv, true);
27947 }
27948
27949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
27950         LDKIOError e_conv = LDKIOError_from_java(env, e);
27951         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27952         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
27953         return tag_ptr(ret_conv, true);
27954 }
27955
27956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27957         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
27958         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
27959         return ret_conv;
27960 }
27961
27962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27963         if (!ptr_is_owned(_res)) return;
27964         void* _res_ptr = untag_ptr(_res);
27965         CHECK_ACCESS(_res_ptr);
27966         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
27967         FREE(untag_ptr(_res));
27968         CResult_CVec_StrZIOErrorZ_free(_res_conv);
27969 }
27970
27971 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
27972         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27973         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
27974         return tag_ptr(ret_conv, true);
27975 }
27976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27977         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
27978         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
27979         return ret_conv;
27980 }
27981
27982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27983         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
27984         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27985         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
27986         return tag_ptr(ret_conv, true);
27987 }
27988
27989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27990         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
27991         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27992         if (_res_constr.datalen > 0)
27993                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
27994         else
27995                 _res_constr.data = NULL;
27996         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27997         for (size_t o = 0; o < _res_constr.datalen; o++) {
27998                 int64_t _res_conv_40 = _res_vals[o];
27999                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
28000                 CHECK_ACCESS(_res_conv_40_ptr);
28001                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
28002                 FREE(untag_ptr(_res_conv_40));
28003                 _res_constr.data[o] = _res_conv_40_conv;
28004         }
28005         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28006         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
28007 }
28008
28009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
28010         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
28011         o_constr.datalen = (*env)->GetArrayLength(env, o);
28012         if (o_constr.datalen > 0)
28013                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
28014         else
28015                 o_constr.data = NULL;
28016         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
28017         for (size_t o = 0; o < o_constr.datalen; o++) {
28018                 int64_t o_conv_40 = o_vals[o];
28019                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
28020                 CHECK_ACCESS(o_conv_40_ptr);
28021                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
28022                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
28023                 o_constr.data[o] = o_conv_40_conv;
28024         }
28025         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
28026         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28027         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
28028         return tag_ptr(ret_conv, true);
28029 }
28030
28031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28032         LDKIOError e_conv = LDKIOError_from_java(env, e);
28033         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28034         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
28035         return tag_ptr(ret_conv, true);
28036 }
28037
28038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28039         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
28040         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
28041         return ret_conv;
28042 }
28043
28044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28045         if (!ptr_is_owned(_res)) return;
28046         void* _res_ptr = untag_ptr(_res);
28047         CHECK_ACCESS(_res_ptr);
28048         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
28049         FREE(untag_ptr(_res));
28050         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
28051 }
28052
28053 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
28054         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28055         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
28056         return tag_ptr(ret_conv, true);
28057 }
28058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28059         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
28060         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
28061         return ret_conv;
28062 }
28063
28064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28065         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
28066         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28067         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
28068         return tag_ptr(ret_conv, true);
28069 }
28070
28071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28072         void* o_ptr = untag_ptr(o);
28073         CHECK_ACCESS(o_ptr);
28074         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
28075         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
28076         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28077         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
28078         return tag_ptr(ret_conv, true);
28079 }
28080
28081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28082         LDKIOError e_conv = LDKIOError_from_java(env, e);
28083         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28084         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
28085         return tag_ptr(ret_conv, true);
28086 }
28087
28088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28089         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
28090         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
28091         return ret_conv;
28092 }
28093
28094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28095         if (!ptr_is_owned(_res)) return;
28096         void* _res_ptr = untag_ptr(_res);
28097         CHECK_ACCESS(_res_ptr);
28098         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
28099         FREE(untag_ptr(_res));
28100         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
28101 }
28102
28103 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
28104         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28105         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
28106         return tag_ptr(ret_conv, true);
28107 }
28108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28109         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
28110         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
28111         return ret_conv;
28112 }
28113
28114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28115         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
28116         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28117         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
28118         return tag_ptr(ret_conv, true);
28119 }
28120
28121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
28122         LDKSecretKey o_ref;
28123         CHECK((*env)->GetArrayLength(env, o) == 32);
28124         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
28125         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28126         *ret_copy = COption_SecretKeyZ_some(o_ref);
28127         int64_t ret_ref = tag_ptr(ret_copy, true);
28128         return ret_ref;
28129 }
28130
28131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1none(JNIEnv *env, jclass clz) {
28132         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28133         *ret_copy = COption_SecretKeyZ_none();
28134         int64_t ret_ref = tag_ptr(ret_copy, true);
28135         return ret_ref;
28136 }
28137
28138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28139         if (!ptr_is_owned(_res)) return;
28140         void* _res_ptr = untag_ptr(_res);
28141         CHECK_ACCESS(_res_ptr);
28142         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
28143         FREE(untag_ptr(_res));
28144         COption_SecretKeyZ_free(_res_conv);
28145 }
28146
28147 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
28148         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28149         *ret_copy = COption_SecretKeyZ_clone(arg);
28150         int64_t ret_ref = tag_ptr(ret_copy, true);
28151         return ret_ref;
28152 }
28153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28154         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
28155         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
28156         return ret_conv;
28157 }
28158
28159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28160         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
28161         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28162         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
28163         int64_t ret_ref = tag_ptr(ret_copy, true);
28164         return ret_ref;
28165 }
28166
28167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28168         LDKVerifiedInvoiceRequest o_conv;
28169         o_conv.inner = untag_ptr(o);
28170         o_conv.is_owned = ptr_is_owned(o);
28171         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28172         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
28173         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28174         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
28175         return tag_ptr(ret_conv, true);
28176 }
28177
28178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1err(JNIEnv *env, jclass clz) {
28179         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28180         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
28181         return tag_ptr(ret_conv, true);
28182 }
28183
28184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28185         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
28186         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
28187         return ret_conv;
28188 }
28189
28190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28191         if (!ptr_is_owned(_res)) return;
28192         void* _res_ptr = untag_ptr(_res);
28193         CHECK_ACCESS(_res_ptr);
28194         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
28195         FREE(untag_ptr(_res));
28196         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
28197 }
28198
28199 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
28200         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28201         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
28202         return tag_ptr(ret_conv, true);
28203 }
28204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28205         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
28206         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
28207         return ret_conv;
28208 }
28209
28210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28211         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
28212         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28213         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
28214         return tag_ptr(ret_conv, true);
28215 }
28216
28217 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
28218         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
28219         return ret_conv;
28220 }
28221
28222 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
28223         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
28224         return ret_conv;
28225 }
28226
28227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
28228         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
28229         COption_NoneZ_free(_res_conv);
28230 }
28231
28232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
28233         LDKCVec_WitnessZ _res_constr;
28234         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28235         if (_res_constr.datalen > 0)
28236                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
28237         else
28238                 _res_constr.data = NULL;
28239         for (size_t i = 0; i < _res_constr.datalen; i++) {
28240                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
28241                 LDKWitness _res_conv_8_ref;
28242                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
28243                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
28244                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
28245                 _res_conv_8_ref.data_is_owned = true;
28246                 _res_constr.data[i] = _res_conv_8_ref;
28247         }
28248         CVec_WitnessZ_free(_res_constr);
28249 }
28250
28251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
28252         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28253         *ret_copy = COption_i64Z_some(o);
28254         int64_t ret_ref = tag_ptr(ret_copy, true);
28255         return ret_ref;
28256 }
28257
28258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
28259         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28260         *ret_copy = COption_i64Z_none();
28261         int64_t ret_ref = tag_ptr(ret_copy, true);
28262         return ret_ref;
28263 }
28264
28265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
28266         if (!ptr_is_owned(_res)) return;
28267         void* _res_ptr = untag_ptr(_res);
28268         CHECK_ACCESS(_res_ptr);
28269         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
28270         FREE(untag_ptr(_res));
28271         COption_i64Z_free(_res_conv);
28272 }
28273
28274 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
28275         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28276         *ret_copy = COption_i64Z_clone(arg);
28277         int64_t ret_ref = tag_ptr(ret_copy, true);
28278         return ret_ref;
28279 }
28280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28281         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
28282         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
28283         return ret_conv;
28284 }
28285
28286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28287         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
28288         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28289         *ret_copy = COption_i64Z_clone(orig_conv);
28290         int64_t ret_ref = tag_ptr(ret_copy, true);
28291         return ret_ref;
28292 }
28293
28294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28295         void* o_ptr = untag_ptr(o);
28296         CHECK_ACCESS(o_ptr);
28297         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28298         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28299         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28300         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
28301         return tag_ptr(ret_conv, true);
28302 }
28303
28304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28305         void* e_ptr = untag_ptr(e);
28306         CHECK_ACCESS(e_ptr);
28307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28309         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28310         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
28311         return tag_ptr(ret_conv, true);
28312 }
28313
28314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28315         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
28316         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
28317         return ret_conv;
28318 }
28319
28320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28321         if (!ptr_is_owned(_res)) return;
28322         void* _res_ptr = untag_ptr(_res);
28323         CHECK_ACCESS(_res_ptr);
28324         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
28325         FREE(untag_ptr(_res));
28326         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
28327 }
28328
28329 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
28330         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28331         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
28332         return tag_ptr(ret_conv, true);
28333 }
28334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28335         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
28336         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
28337         return ret_conv;
28338 }
28339
28340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28341         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
28342         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28343         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
28344         return tag_ptr(ret_conv, true);
28345 }
28346
28347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28348         void* o_ptr = untag_ptr(o);
28349         CHECK_ACCESS(o_ptr);
28350         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28351         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28352         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28353         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
28354         return tag_ptr(ret_conv, true);
28355 }
28356
28357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28358         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_java(env, e);
28359         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28360         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
28361         return tag_ptr(ret_conv, true);
28362 }
28363
28364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28365         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
28366         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
28367         return ret_conv;
28368 }
28369
28370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28371         if (!ptr_is_owned(_res)) return;
28372         void* _res_ptr = untag_ptr(_res);
28373         CHECK_ACCESS(_res_ptr);
28374         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
28375         FREE(untag_ptr(_res));
28376         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
28377 }
28378
28379 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
28380         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28381         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
28382         return tag_ptr(ret_conv, true);
28383 }
28384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28385         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
28386         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
28387         return ret_conv;
28388 }
28389
28390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28391         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
28392         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28393         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
28394         return tag_ptr(ret_conv, true);
28395 }
28396
28397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28398         LDKCVec_UpdateAddHTLCZ _res_constr;
28399         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28400         if (_res_constr.datalen > 0)
28401                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
28402         else
28403                 _res_constr.data = NULL;
28404         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28405         for (size_t p = 0; p < _res_constr.datalen; p++) {
28406                 int64_t _res_conv_15 = _res_vals[p];
28407                 LDKUpdateAddHTLC _res_conv_15_conv;
28408                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
28409                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
28410                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
28411                 _res_constr.data[p] = _res_conv_15_conv;
28412         }
28413         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28414         CVec_UpdateAddHTLCZ_free(_res_constr);
28415 }
28416
28417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28418         LDKCVec_UpdateFulfillHTLCZ _res_constr;
28419         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28420         if (_res_constr.datalen > 0)
28421                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
28422         else
28423                 _res_constr.data = NULL;
28424         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28425         for (size_t t = 0; t < _res_constr.datalen; t++) {
28426                 int64_t _res_conv_19 = _res_vals[t];
28427                 LDKUpdateFulfillHTLC _res_conv_19_conv;
28428                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
28429                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
28430                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
28431                 _res_constr.data[t] = _res_conv_19_conv;
28432         }
28433         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28434         CVec_UpdateFulfillHTLCZ_free(_res_constr);
28435 }
28436
28437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28438         LDKCVec_UpdateFailHTLCZ _res_constr;
28439         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28440         if (_res_constr.datalen > 0)
28441                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
28442         else
28443                 _res_constr.data = NULL;
28444         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28445         for (size_t q = 0; q < _res_constr.datalen; q++) {
28446                 int64_t _res_conv_16 = _res_vals[q];
28447                 LDKUpdateFailHTLC _res_conv_16_conv;
28448                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
28449                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
28450                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
28451                 _res_constr.data[q] = _res_conv_16_conv;
28452         }
28453         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28454         CVec_UpdateFailHTLCZ_free(_res_constr);
28455 }
28456
28457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28458         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
28459         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28460         if (_res_constr.datalen > 0)
28461                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
28462         else
28463                 _res_constr.data = NULL;
28464         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28465         for (size_t z = 0; z < _res_constr.datalen; z++) {
28466                 int64_t _res_conv_25 = _res_vals[z];
28467                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
28468                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
28469                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
28470                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
28471                 _res_constr.data[z] = _res_conv_25_conv;
28472         }
28473         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28474         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
28475 }
28476
28477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28478         LDKAcceptChannel o_conv;
28479         o_conv.inner = untag_ptr(o);
28480         o_conv.is_owned = ptr_is_owned(o);
28481         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28482         o_conv = AcceptChannel_clone(&o_conv);
28483         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28484         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
28485         return tag_ptr(ret_conv, true);
28486 }
28487
28488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28489         void* e_ptr = untag_ptr(e);
28490         CHECK_ACCESS(e_ptr);
28491         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28492         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28493         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28494         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
28495         return tag_ptr(ret_conv, true);
28496 }
28497
28498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28499         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
28500         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
28501         return ret_conv;
28502 }
28503
28504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28505         if (!ptr_is_owned(_res)) return;
28506         void* _res_ptr = untag_ptr(_res);
28507         CHECK_ACCESS(_res_ptr);
28508         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
28509         FREE(untag_ptr(_res));
28510         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
28511 }
28512
28513 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
28514         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28515         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
28516         return tag_ptr(ret_conv, true);
28517 }
28518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28519         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
28520         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
28521         return ret_conv;
28522 }
28523
28524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28525         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
28526         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28527         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
28528         return tag_ptr(ret_conv, true);
28529 }
28530
28531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28532         LDKAcceptChannelV2 o_conv;
28533         o_conv.inner = untag_ptr(o);
28534         o_conv.is_owned = ptr_is_owned(o);
28535         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28536         o_conv = AcceptChannelV2_clone(&o_conv);
28537         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28538         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
28539         return tag_ptr(ret_conv, true);
28540 }
28541
28542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28543         void* e_ptr = untag_ptr(e);
28544         CHECK_ACCESS(e_ptr);
28545         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28546         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28547         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28548         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
28549         return tag_ptr(ret_conv, true);
28550 }
28551
28552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28553         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
28554         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
28555         return ret_conv;
28556 }
28557
28558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28559         if (!ptr_is_owned(_res)) return;
28560         void* _res_ptr = untag_ptr(_res);
28561         CHECK_ACCESS(_res_ptr);
28562         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
28563         FREE(untag_ptr(_res));
28564         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
28565 }
28566
28567 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
28568         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28569         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
28570         return tag_ptr(ret_conv, true);
28571 }
28572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28573         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
28574         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
28575         return ret_conv;
28576 }
28577
28578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28579         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
28580         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28581         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
28582         return tag_ptr(ret_conv, true);
28583 }
28584
28585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28586         LDKTxAddInput o_conv;
28587         o_conv.inner = untag_ptr(o);
28588         o_conv.is_owned = ptr_is_owned(o);
28589         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28590         o_conv = TxAddInput_clone(&o_conv);
28591         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28592         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
28593         return tag_ptr(ret_conv, true);
28594 }
28595
28596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28597         void* e_ptr = untag_ptr(e);
28598         CHECK_ACCESS(e_ptr);
28599         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28600         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28601         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28602         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
28603         return tag_ptr(ret_conv, true);
28604 }
28605
28606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28607         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
28608         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
28609         return ret_conv;
28610 }
28611
28612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28613         if (!ptr_is_owned(_res)) return;
28614         void* _res_ptr = untag_ptr(_res);
28615         CHECK_ACCESS(_res_ptr);
28616         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
28617         FREE(untag_ptr(_res));
28618         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
28619 }
28620
28621 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
28622         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28623         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
28624         return tag_ptr(ret_conv, true);
28625 }
28626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28627         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
28628         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
28629         return ret_conv;
28630 }
28631
28632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28633         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
28634         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28635         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
28636         return tag_ptr(ret_conv, true);
28637 }
28638
28639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28640         LDKTxAddOutput o_conv;
28641         o_conv.inner = untag_ptr(o);
28642         o_conv.is_owned = ptr_is_owned(o);
28643         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28644         o_conv = TxAddOutput_clone(&o_conv);
28645         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28646         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
28647         return tag_ptr(ret_conv, true);
28648 }
28649
28650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28651         void* e_ptr = untag_ptr(e);
28652         CHECK_ACCESS(e_ptr);
28653         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28654         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28655         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28656         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
28657         return tag_ptr(ret_conv, true);
28658 }
28659
28660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28661         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
28662         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
28663         return ret_conv;
28664 }
28665
28666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28667         if (!ptr_is_owned(_res)) return;
28668         void* _res_ptr = untag_ptr(_res);
28669         CHECK_ACCESS(_res_ptr);
28670         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
28671         FREE(untag_ptr(_res));
28672         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
28673 }
28674
28675 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
28676         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28677         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
28678         return tag_ptr(ret_conv, true);
28679 }
28680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28681         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
28682         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
28683         return ret_conv;
28684 }
28685
28686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28687         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
28688         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28689         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
28690         return tag_ptr(ret_conv, true);
28691 }
28692
28693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28694         LDKTxRemoveInput o_conv;
28695         o_conv.inner = untag_ptr(o);
28696         o_conv.is_owned = ptr_is_owned(o);
28697         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28698         o_conv = TxRemoveInput_clone(&o_conv);
28699         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28700         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
28701         return tag_ptr(ret_conv, true);
28702 }
28703
28704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28705         void* e_ptr = untag_ptr(e);
28706         CHECK_ACCESS(e_ptr);
28707         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28708         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28709         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28710         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
28711         return tag_ptr(ret_conv, true);
28712 }
28713
28714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28715         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
28716         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
28717         return ret_conv;
28718 }
28719
28720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28721         if (!ptr_is_owned(_res)) return;
28722         void* _res_ptr = untag_ptr(_res);
28723         CHECK_ACCESS(_res_ptr);
28724         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
28725         FREE(untag_ptr(_res));
28726         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
28727 }
28728
28729 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
28730         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28731         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
28732         return tag_ptr(ret_conv, true);
28733 }
28734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28735         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
28736         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
28737         return ret_conv;
28738 }
28739
28740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28741         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
28742         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28743         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
28744         return tag_ptr(ret_conv, true);
28745 }
28746
28747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28748         LDKTxRemoveOutput o_conv;
28749         o_conv.inner = untag_ptr(o);
28750         o_conv.is_owned = ptr_is_owned(o);
28751         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28752         o_conv = TxRemoveOutput_clone(&o_conv);
28753         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28754         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
28755         return tag_ptr(ret_conv, true);
28756 }
28757
28758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28759         void* e_ptr = untag_ptr(e);
28760         CHECK_ACCESS(e_ptr);
28761         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28762         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28763         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28764         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
28765         return tag_ptr(ret_conv, true);
28766 }
28767
28768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28769         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
28770         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
28771         return ret_conv;
28772 }
28773
28774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28775         if (!ptr_is_owned(_res)) return;
28776         void* _res_ptr = untag_ptr(_res);
28777         CHECK_ACCESS(_res_ptr);
28778         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
28779         FREE(untag_ptr(_res));
28780         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
28781 }
28782
28783 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
28784         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28785         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
28786         return tag_ptr(ret_conv, true);
28787 }
28788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28789         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
28790         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
28791         return ret_conv;
28792 }
28793
28794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28795         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
28796         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28797         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
28798         return tag_ptr(ret_conv, true);
28799 }
28800
28801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28802         LDKTxComplete o_conv;
28803         o_conv.inner = untag_ptr(o);
28804         o_conv.is_owned = ptr_is_owned(o);
28805         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28806         o_conv = TxComplete_clone(&o_conv);
28807         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28808         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
28809         return tag_ptr(ret_conv, true);
28810 }
28811
28812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28813         void* e_ptr = untag_ptr(e);
28814         CHECK_ACCESS(e_ptr);
28815         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28816         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28817         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28818         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
28819         return tag_ptr(ret_conv, true);
28820 }
28821
28822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28823         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
28824         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
28825         return ret_conv;
28826 }
28827
28828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28829         if (!ptr_is_owned(_res)) return;
28830         void* _res_ptr = untag_ptr(_res);
28831         CHECK_ACCESS(_res_ptr);
28832         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
28833         FREE(untag_ptr(_res));
28834         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
28835 }
28836
28837 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
28838         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28839         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
28840         return tag_ptr(ret_conv, true);
28841 }
28842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28843         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
28844         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
28845         return ret_conv;
28846 }
28847
28848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28849         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
28850         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28851         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
28852         return tag_ptr(ret_conv, true);
28853 }
28854
28855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28856         LDKTxSignatures o_conv;
28857         o_conv.inner = untag_ptr(o);
28858         o_conv.is_owned = ptr_is_owned(o);
28859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28860         o_conv = TxSignatures_clone(&o_conv);
28861         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28862         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
28863         return tag_ptr(ret_conv, true);
28864 }
28865
28866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28867         void* e_ptr = untag_ptr(e);
28868         CHECK_ACCESS(e_ptr);
28869         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28870         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28871         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28872         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
28873         return tag_ptr(ret_conv, true);
28874 }
28875
28876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28877         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
28878         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
28879         return ret_conv;
28880 }
28881
28882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28883         if (!ptr_is_owned(_res)) return;
28884         void* _res_ptr = untag_ptr(_res);
28885         CHECK_ACCESS(_res_ptr);
28886         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
28887         FREE(untag_ptr(_res));
28888         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
28889 }
28890
28891 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28892         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28893         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
28894         return tag_ptr(ret_conv, true);
28895 }
28896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28897         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
28898         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28899         return ret_conv;
28900 }
28901
28902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28903         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
28904         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28905         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
28906         return tag_ptr(ret_conv, true);
28907 }
28908
28909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28910         LDKTxInitRbf o_conv;
28911         o_conv.inner = untag_ptr(o);
28912         o_conv.is_owned = ptr_is_owned(o);
28913         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28914         o_conv = TxInitRbf_clone(&o_conv);
28915         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28916         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
28917         return tag_ptr(ret_conv, true);
28918 }
28919
28920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28921         void* e_ptr = untag_ptr(e);
28922         CHECK_ACCESS(e_ptr);
28923         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28924         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28925         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28926         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
28927         return tag_ptr(ret_conv, true);
28928 }
28929
28930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28931         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
28932         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
28933         return ret_conv;
28934 }
28935
28936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28937         if (!ptr_is_owned(_res)) return;
28938         void* _res_ptr = untag_ptr(_res);
28939         CHECK_ACCESS(_res_ptr);
28940         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
28941         FREE(untag_ptr(_res));
28942         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
28943 }
28944
28945 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
28946         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28947         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
28948         return tag_ptr(ret_conv, true);
28949 }
28950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28951         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
28952         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
28953         return ret_conv;
28954 }
28955
28956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28957         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
28958         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28959         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
28960         return tag_ptr(ret_conv, true);
28961 }
28962
28963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28964         LDKTxAckRbf o_conv;
28965         o_conv.inner = untag_ptr(o);
28966         o_conv.is_owned = ptr_is_owned(o);
28967         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28968         o_conv = TxAckRbf_clone(&o_conv);
28969         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28970         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
28971         return tag_ptr(ret_conv, true);
28972 }
28973
28974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28975         void* e_ptr = untag_ptr(e);
28976         CHECK_ACCESS(e_ptr);
28977         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28978         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28979         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28980         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
28981         return tag_ptr(ret_conv, true);
28982 }
28983
28984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28985         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
28986         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
28987         return ret_conv;
28988 }
28989
28990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28991         if (!ptr_is_owned(_res)) return;
28992         void* _res_ptr = untag_ptr(_res);
28993         CHECK_ACCESS(_res_ptr);
28994         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
28995         FREE(untag_ptr(_res));
28996         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
28997 }
28998
28999 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
29000         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29001         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
29002         return tag_ptr(ret_conv, true);
29003 }
29004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29005         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
29006         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
29007         return ret_conv;
29008 }
29009
29010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29011         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
29012         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29013         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
29014         return tag_ptr(ret_conv, true);
29015 }
29016
29017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29018         LDKTxAbort o_conv;
29019         o_conv.inner = untag_ptr(o);
29020         o_conv.is_owned = ptr_is_owned(o);
29021         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29022         o_conv = TxAbort_clone(&o_conv);
29023         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29024         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
29025         return tag_ptr(ret_conv, true);
29026 }
29027
29028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29029         void* e_ptr = untag_ptr(e);
29030         CHECK_ACCESS(e_ptr);
29031         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29032         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29033         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29034         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
29035         return tag_ptr(ret_conv, true);
29036 }
29037
29038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29039         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
29040         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
29041         return ret_conv;
29042 }
29043
29044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29045         if (!ptr_is_owned(_res)) return;
29046         void* _res_ptr = untag_ptr(_res);
29047         CHECK_ACCESS(_res_ptr);
29048         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
29049         FREE(untag_ptr(_res));
29050         CResult_TxAbortDecodeErrorZ_free(_res_conv);
29051 }
29052
29053 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
29054         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29055         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
29056         return tag_ptr(ret_conv, true);
29057 }
29058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29059         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
29060         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
29061         return ret_conv;
29062 }
29063
29064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29065         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
29066         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29067         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
29068         return tag_ptr(ret_conv, true);
29069 }
29070
29071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29072         LDKAnnouncementSignatures o_conv;
29073         o_conv.inner = untag_ptr(o);
29074         o_conv.is_owned = ptr_is_owned(o);
29075         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29076         o_conv = AnnouncementSignatures_clone(&o_conv);
29077         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29078         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
29079         return tag_ptr(ret_conv, true);
29080 }
29081
29082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29083         void* e_ptr = untag_ptr(e);
29084         CHECK_ACCESS(e_ptr);
29085         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29086         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29087         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29088         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
29089         return tag_ptr(ret_conv, true);
29090 }
29091
29092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29093         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
29094         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
29095         return ret_conv;
29096 }
29097
29098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29099         if (!ptr_is_owned(_res)) return;
29100         void* _res_ptr = untag_ptr(_res);
29101         CHECK_ACCESS(_res_ptr);
29102         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
29103         FREE(untag_ptr(_res));
29104         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
29105 }
29106
29107 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
29108         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29109         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
29110         return tag_ptr(ret_conv, true);
29111 }
29112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29113         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
29114         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
29115         return ret_conv;
29116 }
29117
29118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29119         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
29120         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29121         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
29122         return tag_ptr(ret_conv, true);
29123 }
29124
29125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29126         LDKChannelReestablish o_conv;
29127         o_conv.inner = untag_ptr(o);
29128         o_conv.is_owned = ptr_is_owned(o);
29129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29130         o_conv = ChannelReestablish_clone(&o_conv);
29131         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29132         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
29133         return tag_ptr(ret_conv, true);
29134 }
29135
29136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29137         void* e_ptr = untag_ptr(e);
29138         CHECK_ACCESS(e_ptr);
29139         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29140         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29141         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29142         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
29143         return tag_ptr(ret_conv, true);
29144 }
29145
29146 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29147         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
29148         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
29149         return ret_conv;
29150 }
29151
29152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29153         if (!ptr_is_owned(_res)) return;
29154         void* _res_ptr = untag_ptr(_res);
29155         CHECK_ACCESS(_res_ptr);
29156         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
29157         FREE(untag_ptr(_res));
29158         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
29159 }
29160
29161 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
29162         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29163         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
29164         return tag_ptr(ret_conv, true);
29165 }
29166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29167         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
29168         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
29169         return ret_conv;
29170 }
29171
29172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29173         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
29174         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29175         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
29176         return tag_ptr(ret_conv, true);
29177 }
29178
29179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29180         LDKClosingSigned o_conv;
29181         o_conv.inner = untag_ptr(o);
29182         o_conv.is_owned = ptr_is_owned(o);
29183         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29184         o_conv = ClosingSigned_clone(&o_conv);
29185         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29186         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
29187         return tag_ptr(ret_conv, true);
29188 }
29189
29190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29191         void* e_ptr = untag_ptr(e);
29192         CHECK_ACCESS(e_ptr);
29193         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29194         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29195         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29196         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
29197         return tag_ptr(ret_conv, true);
29198 }
29199
29200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29201         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
29202         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
29203         return ret_conv;
29204 }
29205
29206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29207         if (!ptr_is_owned(_res)) return;
29208         void* _res_ptr = untag_ptr(_res);
29209         CHECK_ACCESS(_res_ptr);
29210         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
29211         FREE(untag_ptr(_res));
29212         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
29213 }
29214
29215 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
29216         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29217         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
29218         return tag_ptr(ret_conv, true);
29219 }
29220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29221         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
29222         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
29223         return ret_conv;
29224 }
29225
29226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29227         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
29228         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29229         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
29230         return tag_ptr(ret_conv, true);
29231 }
29232
29233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29234         LDKClosingSignedFeeRange o_conv;
29235         o_conv.inner = untag_ptr(o);
29236         o_conv.is_owned = ptr_is_owned(o);
29237         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29238         o_conv = ClosingSignedFeeRange_clone(&o_conv);
29239         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29240         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
29241         return tag_ptr(ret_conv, true);
29242 }
29243
29244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29245         void* e_ptr = untag_ptr(e);
29246         CHECK_ACCESS(e_ptr);
29247         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29248         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29249         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29250         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
29251         return tag_ptr(ret_conv, true);
29252 }
29253
29254 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29255         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
29256         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
29257         return ret_conv;
29258 }
29259
29260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29261         if (!ptr_is_owned(_res)) return;
29262         void* _res_ptr = untag_ptr(_res);
29263         CHECK_ACCESS(_res_ptr);
29264         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
29265         FREE(untag_ptr(_res));
29266         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
29267 }
29268
29269 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
29270         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29271         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
29272         return tag_ptr(ret_conv, true);
29273 }
29274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29275         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
29276         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
29277         return ret_conv;
29278 }
29279
29280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29281         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
29282         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29283         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
29284         return tag_ptr(ret_conv, true);
29285 }
29286
29287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29288         LDKCommitmentSigned o_conv;
29289         o_conv.inner = untag_ptr(o);
29290         o_conv.is_owned = ptr_is_owned(o);
29291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29292         o_conv = CommitmentSigned_clone(&o_conv);
29293         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29294         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
29295         return tag_ptr(ret_conv, true);
29296 }
29297
29298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29299         void* e_ptr = untag_ptr(e);
29300         CHECK_ACCESS(e_ptr);
29301         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29302         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29303         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29304         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
29305         return tag_ptr(ret_conv, true);
29306 }
29307
29308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29309         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
29310         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
29311         return ret_conv;
29312 }
29313
29314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29315         if (!ptr_is_owned(_res)) return;
29316         void* _res_ptr = untag_ptr(_res);
29317         CHECK_ACCESS(_res_ptr);
29318         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
29319         FREE(untag_ptr(_res));
29320         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
29321 }
29322
29323 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
29324         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29325         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
29326         return tag_ptr(ret_conv, true);
29327 }
29328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29329         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
29330         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
29331         return ret_conv;
29332 }
29333
29334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29335         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
29336         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29337         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
29338         return tag_ptr(ret_conv, true);
29339 }
29340
29341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29342         LDKFundingCreated o_conv;
29343         o_conv.inner = untag_ptr(o);
29344         o_conv.is_owned = ptr_is_owned(o);
29345         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29346         o_conv = FundingCreated_clone(&o_conv);
29347         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29348         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
29349         return tag_ptr(ret_conv, true);
29350 }
29351
29352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29353         void* e_ptr = untag_ptr(e);
29354         CHECK_ACCESS(e_ptr);
29355         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29356         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29357         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29358         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
29359         return tag_ptr(ret_conv, true);
29360 }
29361
29362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29363         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
29364         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
29365         return ret_conv;
29366 }
29367
29368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29369         if (!ptr_is_owned(_res)) return;
29370         void* _res_ptr = untag_ptr(_res);
29371         CHECK_ACCESS(_res_ptr);
29372         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
29373         FREE(untag_ptr(_res));
29374         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
29375 }
29376
29377 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
29378         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29379         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
29380         return tag_ptr(ret_conv, true);
29381 }
29382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29383         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
29384         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
29385         return ret_conv;
29386 }
29387
29388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29389         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
29390         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29391         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
29392         return tag_ptr(ret_conv, true);
29393 }
29394
29395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29396         LDKFundingSigned o_conv;
29397         o_conv.inner = untag_ptr(o);
29398         o_conv.is_owned = ptr_is_owned(o);
29399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29400         o_conv = FundingSigned_clone(&o_conv);
29401         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29402         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
29403         return tag_ptr(ret_conv, true);
29404 }
29405
29406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29407         void* e_ptr = untag_ptr(e);
29408         CHECK_ACCESS(e_ptr);
29409         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29410         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29411         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29412         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
29413         return tag_ptr(ret_conv, true);
29414 }
29415
29416 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29417         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
29418         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
29419         return ret_conv;
29420 }
29421
29422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29423         if (!ptr_is_owned(_res)) return;
29424         void* _res_ptr = untag_ptr(_res);
29425         CHECK_ACCESS(_res_ptr);
29426         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
29427         FREE(untag_ptr(_res));
29428         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
29429 }
29430
29431 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
29432         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29433         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
29434         return tag_ptr(ret_conv, true);
29435 }
29436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29437         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
29438         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
29439         return ret_conv;
29440 }
29441
29442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29443         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
29444         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29445         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
29446         return tag_ptr(ret_conv, true);
29447 }
29448
29449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29450         LDKChannelReady o_conv;
29451         o_conv.inner = untag_ptr(o);
29452         o_conv.is_owned = ptr_is_owned(o);
29453         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29454         o_conv = ChannelReady_clone(&o_conv);
29455         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29456         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
29457         return tag_ptr(ret_conv, true);
29458 }
29459
29460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29461         void* e_ptr = untag_ptr(e);
29462         CHECK_ACCESS(e_ptr);
29463         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29464         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29465         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29466         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
29467         return tag_ptr(ret_conv, true);
29468 }
29469
29470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29471         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
29472         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
29473         return ret_conv;
29474 }
29475
29476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29477         if (!ptr_is_owned(_res)) return;
29478         void* _res_ptr = untag_ptr(_res);
29479         CHECK_ACCESS(_res_ptr);
29480         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
29481         FREE(untag_ptr(_res));
29482         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
29483 }
29484
29485 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
29486         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29487         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
29488         return tag_ptr(ret_conv, true);
29489 }
29490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29491         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
29492         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
29493         return ret_conv;
29494 }
29495
29496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29497         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
29498         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29499         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
29500         return tag_ptr(ret_conv, true);
29501 }
29502
29503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29504         LDKInit o_conv;
29505         o_conv.inner = untag_ptr(o);
29506         o_conv.is_owned = ptr_is_owned(o);
29507         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29508         o_conv = Init_clone(&o_conv);
29509         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29510         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
29511         return tag_ptr(ret_conv, true);
29512 }
29513
29514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29515         void* e_ptr = untag_ptr(e);
29516         CHECK_ACCESS(e_ptr);
29517         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29518         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29519         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29520         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
29521         return tag_ptr(ret_conv, true);
29522 }
29523
29524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29525         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
29526         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
29527         return ret_conv;
29528 }
29529
29530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29531         if (!ptr_is_owned(_res)) return;
29532         void* _res_ptr = untag_ptr(_res);
29533         CHECK_ACCESS(_res_ptr);
29534         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
29535         FREE(untag_ptr(_res));
29536         CResult_InitDecodeErrorZ_free(_res_conv);
29537 }
29538
29539 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
29540         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29541         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
29542         return tag_ptr(ret_conv, true);
29543 }
29544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29545         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
29546         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
29547         return ret_conv;
29548 }
29549
29550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29551         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
29552         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29553         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
29554         return tag_ptr(ret_conv, true);
29555 }
29556
29557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29558         LDKOpenChannel o_conv;
29559         o_conv.inner = untag_ptr(o);
29560         o_conv.is_owned = ptr_is_owned(o);
29561         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29562         o_conv = OpenChannel_clone(&o_conv);
29563         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29564         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
29565         return tag_ptr(ret_conv, true);
29566 }
29567
29568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29569         void* e_ptr = untag_ptr(e);
29570         CHECK_ACCESS(e_ptr);
29571         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29572         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29573         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29574         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
29575         return tag_ptr(ret_conv, true);
29576 }
29577
29578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29579         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
29580         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
29581         return ret_conv;
29582 }
29583
29584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29585         if (!ptr_is_owned(_res)) return;
29586         void* _res_ptr = untag_ptr(_res);
29587         CHECK_ACCESS(_res_ptr);
29588         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
29589         FREE(untag_ptr(_res));
29590         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
29591 }
29592
29593 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
29594         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29595         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
29596         return tag_ptr(ret_conv, true);
29597 }
29598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29599         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
29600         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
29601         return ret_conv;
29602 }
29603
29604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29605         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
29606         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29607         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
29608         return tag_ptr(ret_conv, true);
29609 }
29610
29611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29612         LDKOpenChannelV2 o_conv;
29613         o_conv.inner = untag_ptr(o);
29614         o_conv.is_owned = ptr_is_owned(o);
29615         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29616         o_conv = OpenChannelV2_clone(&o_conv);
29617         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29618         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
29619         return tag_ptr(ret_conv, true);
29620 }
29621
29622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29623         void* e_ptr = untag_ptr(e);
29624         CHECK_ACCESS(e_ptr);
29625         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29626         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29627         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29628         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
29629         return tag_ptr(ret_conv, true);
29630 }
29631
29632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29633         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
29634         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
29635         return ret_conv;
29636 }
29637
29638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29639         if (!ptr_is_owned(_res)) return;
29640         void* _res_ptr = untag_ptr(_res);
29641         CHECK_ACCESS(_res_ptr);
29642         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
29643         FREE(untag_ptr(_res));
29644         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
29645 }
29646
29647 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
29648         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29649         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
29650         return tag_ptr(ret_conv, true);
29651 }
29652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29653         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
29654         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
29655         return ret_conv;
29656 }
29657
29658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29659         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
29660         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29661         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
29662         return tag_ptr(ret_conv, true);
29663 }
29664
29665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29666         LDKRevokeAndACK o_conv;
29667         o_conv.inner = untag_ptr(o);
29668         o_conv.is_owned = ptr_is_owned(o);
29669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29670         o_conv = RevokeAndACK_clone(&o_conv);
29671         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29672         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
29673         return tag_ptr(ret_conv, true);
29674 }
29675
29676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29677         void* e_ptr = untag_ptr(e);
29678         CHECK_ACCESS(e_ptr);
29679         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29680         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29681         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29682         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
29683         return tag_ptr(ret_conv, true);
29684 }
29685
29686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29687         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
29688         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
29689         return ret_conv;
29690 }
29691
29692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29693         if (!ptr_is_owned(_res)) return;
29694         void* _res_ptr = untag_ptr(_res);
29695         CHECK_ACCESS(_res_ptr);
29696         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
29697         FREE(untag_ptr(_res));
29698         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
29699 }
29700
29701 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
29702         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29703         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
29704         return tag_ptr(ret_conv, true);
29705 }
29706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29707         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
29708         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
29709         return ret_conv;
29710 }
29711
29712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29713         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
29714         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29715         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
29716         return tag_ptr(ret_conv, true);
29717 }
29718
29719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29720         LDKShutdown o_conv;
29721         o_conv.inner = untag_ptr(o);
29722         o_conv.is_owned = ptr_is_owned(o);
29723         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29724         o_conv = Shutdown_clone(&o_conv);
29725         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29726         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
29727         return tag_ptr(ret_conv, true);
29728 }
29729
29730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29731         void* e_ptr = untag_ptr(e);
29732         CHECK_ACCESS(e_ptr);
29733         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29734         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29735         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29736         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
29737         return tag_ptr(ret_conv, true);
29738 }
29739
29740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29741         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
29742         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
29743         return ret_conv;
29744 }
29745
29746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29747         if (!ptr_is_owned(_res)) return;
29748         void* _res_ptr = untag_ptr(_res);
29749         CHECK_ACCESS(_res_ptr);
29750         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
29751         FREE(untag_ptr(_res));
29752         CResult_ShutdownDecodeErrorZ_free(_res_conv);
29753 }
29754
29755 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
29756         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29757         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
29758         return tag_ptr(ret_conv, true);
29759 }
29760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29761         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
29762         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
29763         return ret_conv;
29764 }
29765
29766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29767         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
29768         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29769         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
29770         return tag_ptr(ret_conv, true);
29771 }
29772
29773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29774         LDKUpdateFailHTLC o_conv;
29775         o_conv.inner = untag_ptr(o);
29776         o_conv.is_owned = ptr_is_owned(o);
29777         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29778         o_conv = UpdateFailHTLC_clone(&o_conv);
29779         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29780         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
29781         return tag_ptr(ret_conv, true);
29782 }
29783
29784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29785         void* e_ptr = untag_ptr(e);
29786         CHECK_ACCESS(e_ptr);
29787         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29788         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29789         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29790         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
29791         return tag_ptr(ret_conv, true);
29792 }
29793
29794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29795         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
29796         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
29797         return ret_conv;
29798 }
29799
29800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29801         if (!ptr_is_owned(_res)) return;
29802         void* _res_ptr = untag_ptr(_res);
29803         CHECK_ACCESS(_res_ptr);
29804         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
29805         FREE(untag_ptr(_res));
29806         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
29807 }
29808
29809 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
29810         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29811         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
29812         return tag_ptr(ret_conv, true);
29813 }
29814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29815         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
29816         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
29817         return ret_conv;
29818 }
29819
29820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29821         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
29822         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29823         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
29824         return tag_ptr(ret_conv, true);
29825 }
29826
29827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29828         LDKUpdateFailMalformedHTLC o_conv;
29829         o_conv.inner = untag_ptr(o);
29830         o_conv.is_owned = ptr_is_owned(o);
29831         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29832         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
29833         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29834         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
29835         return tag_ptr(ret_conv, true);
29836 }
29837
29838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29839         void* e_ptr = untag_ptr(e);
29840         CHECK_ACCESS(e_ptr);
29841         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29842         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29843         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29844         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
29845         return tag_ptr(ret_conv, true);
29846 }
29847
29848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29849         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
29850         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
29851         return ret_conv;
29852 }
29853
29854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29855         if (!ptr_is_owned(_res)) return;
29856         void* _res_ptr = untag_ptr(_res);
29857         CHECK_ACCESS(_res_ptr);
29858         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
29859         FREE(untag_ptr(_res));
29860         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
29861 }
29862
29863 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29864         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29865         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
29866         return tag_ptr(ret_conv, true);
29867 }
29868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29869         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
29870         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29871         return ret_conv;
29872 }
29873
29874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29875         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
29876         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29877         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
29878         return tag_ptr(ret_conv, true);
29879 }
29880
29881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29882         LDKUpdateFee o_conv;
29883         o_conv.inner = untag_ptr(o);
29884         o_conv.is_owned = ptr_is_owned(o);
29885         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29886         o_conv = UpdateFee_clone(&o_conv);
29887         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29888         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
29889         return tag_ptr(ret_conv, true);
29890 }
29891
29892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29893         void* e_ptr = untag_ptr(e);
29894         CHECK_ACCESS(e_ptr);
29895         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29896         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29897         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29898         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
29899         return tag_ptr(ret_conv, true);
29900 }
29901
29902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29903         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
29904         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
29905         return ret_conv;
29906 }
29907
29908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29909         if (!ptr_is_owned(_res)) return;
29910         void* _res_ptr = untag_ptr(_res);
29911         CHECK_ACCESS(_res_ptr);
29912         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
29913         FREE(untag_ptr(_res));
29914         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
29915 }
29916
29917 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
29918         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29919         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
29920         return tag_ptr(ret_conv, true);
29921 }
29922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29923         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
29924         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
29925         return ret_conv;
29926 }
29927
29928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29929         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
29930         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29931         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
29932         return tag_ptr(ret_conv, true);
29933 }
29934
29935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29936         LDKUpdateFulfillHTLC o_conv;
29937         o_conv.inner = untag_ptr(o);
29938         o_conv.is_owned = ptr_is_owned(o);
29939         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29940         o_conv = UpdateFulfillHTLC_clone(&o_conv);
29941         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29942         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
29943         return tag_ptr(ret_conv, true);
29944 }
29945
29946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29947         void* e_ptr = untag_ptr(e);
29948         CHECK_ACCESS(e_ptr);
29949         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29950         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29951         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29952         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
29953         return tag_ptr(ret_conv, true);
29954 }
29955
29956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29957         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
29958         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
29959         return ret_conv;
29960 }
29961
29962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29963         if (!ptr_is_owned(_res)) return;
29964         void* _res_ptr = untag_ptr(_res);
29965         CHECK_ACCESS(_res_ptr);
29966         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
29967         FREE(untag_ptr(_res));
29968         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
29969 }
29970
29971 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
29972         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29973         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
29974         return tag_ptr(ret_conv, true);
29975 }
29976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29977         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
29978         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
29979         return ret_conv;
29980 }
29981
29982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29983         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
29984         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29985         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
29986         return tag_ptr(ret_conv, true);
29987 }
29988
29989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29990         LDKUpdateAddHTLC o_conv;
29991         o_conv.inner = untag_ptr(o);
29992         o_conv.is_owned = ptr_is_owned(o);
29993         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29994         o_conv = UpdateAddHTLC_clone(&o_conv);
29995         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29996         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
29997         return tag_ptr(ret_conv, true);
29998 }
29999
30000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30001         void* e_ptr = untag_ptr(e);
30002         CHECK_ACCESS(e_ptr);
30003         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30004         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30005         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30006         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
30007         return tag_ptr(ret_conv, true);
30008 }
30009
30010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30011         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
30012         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
30013         return ret_conv;
30014 }
30015
30016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30017         if (!ptr_is_owned(_res)) return;
30018         void* _res_ptr = untag_ptr(_res);
30019         CHECK_ACCESS(_res_ptr);
30020         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
30021         FREE(untag_ptr(_res));
30022         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
30023 }
30024
30025 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
30026         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30027         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
30028         return tag_ptr(ret_conv, true);
30029 }
30030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30031         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
30032         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
30033         return ret_conv;
30034 }
30035
30036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30037         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
30038         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30039         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
30040         return tag_ptr(ret_conv, true);
30041 }
30042
30043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30044         LDKOnionMessage o_conv;
30045         o_conv.inner = untag_ptr(o);
30046         o_conv.is_owned = ptr_is_owned(o);
30047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30048         o_conv = OnionMessage_clone(&o_conv);
30049         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30050         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
30051         return tag_ptr(ret_conv, true);
30052 }
30053
30054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30055         void* e_ptr = untag_ptr(e);
30056         CHECK_ACCESS(e_ptr);
30057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30059         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30060         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
30061         return tag_ptr(ret_conv, true);
30062 }
30063
30064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30065         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
30066         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
30067         return ret_conv;
30068 }
30069
30070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30071         if (!ptr_is_owned(_res)) return;
30072         void* _res_ptr = untag_ptr(_res);
30073         CHECK_ACCESS(_res_ptr);
30074         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
30075         FREE(untag_ptr(_res));
30076         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
30077 }
30078
30079 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
30080         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30081         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
30082         return tag_ptr(ret_conv, true);
30083 }
30084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30085         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
30086         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
30087         return ret_conv;
30088 }
30089
30090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30091         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
30092         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30093         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
30094         return tag_ptr(ret_conv, true);
30095 }
30096
30097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30098         LDKPing o_conv;
30099         o_conv.inner = untag_ptr(o);
30100         o_conv.is_owned = ptr_is_owned(o);
30101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30102         o_conv = Ping_clone(&o_conv);
30103         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30104         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
30105         return tag_ptr(ret_conv, true);
30106 }
30107
30108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30109         void* e_ptr = untag_ptr(e);
30110         CHECK_ACCESS(e_ptr);
30111         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30112         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30113         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30114         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
30115         return tag_ptr(ret_conv, true);
30116 }
30117
30118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30119         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
30120         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
30121         return ret_conv;
30122 }
30123
30124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30125         if (!ptr_is_owned(_res)) return;
30126         void* _res_ptr = untag_ptr(_res);
30127         CHECK_ACCESS(_res_ptr);
30128         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
30129         FREE(untag_ptr(_res));
30130         CResult_PingDecodeErrorZ_free(_res_conv);
30131 }
30132
30133 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
30134         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30135         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
30136         return tag_ptr(ret_conv, true);
30137 }
30138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30139         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
30140         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
30141         return ret_conv;
30142 }
30143
30144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30145         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
30146         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30147         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
30148         return tag_ptr(ret_conv, true);
30149 }
30150
30151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30152         LDKPong o_conv;
30153         o_conv.inner = untag_ptr(o);
30154         o_conv.is_owned = ptr_is_owned(o);
30155         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30156         o_conv = Pong_clone(&o_conv);
30157         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30158         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
30159         return tag_ptr(ret_conv, true);
30160 }
30161
30162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30163         void* e_ptr = untag_ptr(e);
30164         CHECK_ACCESS(e_ptr);
30165         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30166         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30167         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30168         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
30169         return tag_ptr(ret_conv, true);
30170 }
30171
30172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30173         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
30174         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
30175         return ret_conv;
30176 }
30177
30178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30179         if (!ptr_is_owned(_res)) return;
30180         void* _res_ptr = untag_ptr(_res);
30181         CHECK_ACCESS(_res_ptr);
30182         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
30183         FREE(untag_ptr(_res));
30184         CResult_PongDecodeErrorZ_free(_res_conv);
30185 }
30186
30187 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
30188         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30189         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
30190         return tag_ptr(ret_conv, true);
30191 }
30192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30193         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
30194         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
30195         return ret_conv;
30196 }
30197
30198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30199         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
30200         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30201         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
30202         return tag_ptr(ret_conv, true);
30203 }
30204
30205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30206         LDKUnsignedChannelAnnouncement o_conv;
30207         o_conv.inner = untag_ptr(o);
30208         o_conv.is_owned = ptr_is_owned(o);
30209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30210         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
30211         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30212         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
30213         return tag_ptr(ret_conv, true);
30214 }
30215
30216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30217         void* e_ptr = untag_ptr(e);
30218         CHECK_ACCESS(e_ptr);
30219         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30220         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30221         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30222         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
30223         return tag_ptr(ret_conv, true);
30224 }
30225
30226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30227         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30228         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30229         return ret_conv;
30230 }
30231
30232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30233         if (!ptr_is_owned(_res)) return;
30234         void* _res_ptr = untag_ptr(_res);
30235         CHECK_ACCESS(_res_ptr);
30236         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30237         FREE(untag_ptr(_res));
30238         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
30239 }
30240
30241 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30242         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30243         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
30244         return tag_ptr(ret_conv, true);
30245 }
30246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30247         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30248         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30249         return ret_conv;
30250 }
30251
30252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30253         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30254         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30255         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30256         return tag_ptr(ret_conv, true);
30257 }
30258
30259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30260         LDKChannelAnnouncement o_conv;
30261         o_conv.inner = untag_ptr(o);
30262         o_conv.is_owned = ptr_is_owned(o);
30263         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30264         o_conv = ChannelAnnouncement_clone(&o_conv);
30265         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30266         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
30267         return tag_ptr(ret_conv, true);
30268 }
30269
30270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30271         void* e_ptr = untag_ptr(e);
30272         CHECK_ACCESS(e_ptr);
30273         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30274         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30275         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30276         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
30277         return tag_ptr(ret_conv, true);
30278 }
30279
30280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30281         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30282         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30283         return ret_conv;
30284 }
30285
30286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30287         if (!ptr_is_owned(_res)) return;
30288         void* _res_ptr = untag_ptr(_res);
30289         CHECK_ACCESS(_res_ptr);
30290         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30291         FREE(untag_ptr(_res));
30292         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
30293 }
30294
30295 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30296         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30297         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
30298         return tag_ptr(ret_conv, true);
30299 }
30300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30301         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30302         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30303         return ret_conv;
30304 }
30305
30306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30307         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30308         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30309         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30310         return tag_ptr(ret_conv, true);
30311 }
30312
30313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30314         LDKUnsignedChannelUpdate o_conv;
30315         o_conv.inner = untag_ptr(o);
30316         o_conv.is_owned = ptr_is_owned(o);
30317         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30318         o_conv = UnsignedChannelUpdate_clone(&o_conv);
30319         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30320         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
30321         return tag_ptr(ret_conv, true);
30322 }
30323
30324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30325         void* e_ptr = untag_ptr(e);
30326         CHECK_ACCESS(e_ptr);
30327         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30328         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30329         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30330         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
30331         return tag_ptr(ret_conv, true);
30332 }
30333
30334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30335         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
30336         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
30337         return ret_conv;
30338 }
30339
30340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30341         if (!ptr_is_owned(_res)) return;
30342         void* _res_ptr = untag_ptr(_res);
30343         CHECK_ACCESS(_res_ptr);
30344         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
30345         FREE(untag_ptr(_res));
30346         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
30347 }
30348
30349 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30350         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30351         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
30352         return tag_ptr(ret_conv, true);
30353 }
30354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30355         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30356         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30357         return ret_conv;
30358 }
30359
30360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30361         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30362         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30363         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
30364         return tag_ptr(ret_conv, true);
30365 }
30366
30367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30368         LDKChannelUpdate o_conv;
30369         o_conv.inner = untag_ptr(o);
30370         o_conv.is_owned = ptr_is_owned(o);
30371         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30372         o_conv = ChannelUpdate_clone(&o_conv);
30373         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30374         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
30375         return tag_ptr(ret_conv, true);
30376 }
30377
30378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30379         void* e_ptr = untag_ptr(e);
30380         CHECK_ACCESS(e_ptr);
30381         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30382         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30383         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30384         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
30385         return tag_ptr(ret_conv, true);
30386 }
30387
30388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30389         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
30390         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
30391         return ret_conv;
30392 }
30393
30394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30395         if (!ptr_is_owned(_res)) return;
30396         void* _res_ptr = untag_ptr(_res);
30397         CHECK_ACCESS(_res_ptr);
30398         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
30399         FREE(untag_ptr(_res));
30400         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
30401 }
30402
30403 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30404         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30405         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
30406         return tag_ptr(ret_conv, true);
30407 }
30408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30409         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30410         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30411         return ret_conv;
30412 }
30413
30414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30415         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30416         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30417         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
30418         return tag_ptr(ret_conv, true);
30419 }
30420
30421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30422         LDKErrorMessage o_conv;
30423         o_conv.inner = untag_ptr(o);
30424         o_conv.is_owned = ptr_is_owned(o);
30425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30426         o_conv = ErrorMessage_clone(&o_conv);
30427         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30428         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
30429         return tag_ptr(ret_conv, true);
30430 }
30431
30432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30433         void* e_ptr = untag_ptr(e);
30434         CHECK_ACCESS(e_ptr);
30435         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30436         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30437         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30438         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
30439         return tag_ptr(ret_conv, true);
30440 }
30441
30442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30443         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
30444         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
30445         return ret_conv;
30446 }
30447
30448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30449         if (!ptr_is_owned(_res)) return;
30450         void* _res_ptr = untag_ptr(_res);
30451         CHECK_ACCESS(_res_ptr);
30452         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
30453         FREE(untag_ptr(_res));
30454         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
30455 }
30456
30457 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
30458         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30459         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
30460         return tag_ptr(ret_conv, true);
30461 }
30462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30463         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
30464         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
30465         return ret_conv;
30466 }
30467
30468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30469         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
30470         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30471         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
30472         return tag_ptr(ret_conv, true);
30473 }
30474
30475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30476         LDKWarningMessage o_conv;
30477         o_conv.inner = untag_ptr(o);
30478         o_conv.is_owned = ptr_is_owned(o);
30479         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30480         o_conv = WarningMessage_clone(&o_conv);
30481         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30482         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
30483         return tag_ptr(ret_conv, true);
30484 }
30485
30486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30487         void* e_ptr = untag_ptr(e);
30488         CHECK_ACCESS(e_ptr);
30489         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30490         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30491         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30492         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
30493         return tag_ptr(ret_conv, true);
30494 }
30495
30496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30497         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
30498         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
30499         return ret_conv;
30500 }
30501
30502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30503         if (!ptr_is_owned(_res)) return;
30504         void* _res_ptr = untag_ptr(_res);
30505         CHECK_ACCESS(_res_ptr);
30506         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
30507         FREE(untag_ptr(_res));
30508         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
30509 }
30510
30511 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
30512         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30513         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
30514         return tag_ptr(ret_conv, true);
30515 }
30516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30517         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
30518         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
30519         return ret_conv;
30520 }
30521
30522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30523         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
30524         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30525         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
30526         return tag_ptr(ret_conv, true);
30527 }
30528
30529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30530         LDKUnsignedNodeAnnouncement o_conv;
30531         o_conv.inner = untag_ptr(o);
30532         o_conv.is_owned = ptr_is_owned(o);
30533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30534         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
30535         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30536         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
30537         return tag_ptr(ret_conv, true);
30538 }
30539
30540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30541         void* e_ptr = untag_ptr(e);
30542         CHECK_ACCESS(e_ptr);
30543         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30544         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30545         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30546         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
30547         return tag_ptr(ret_conv, true);
30548 }
30549
30550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30551         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30552         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30553         return ret_conv;
30554 }
30555
30556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30557         if (!ptr_is_owned(_res)) return;
30558         void* _res_ptr = untag_ptr(_res);
30559         CHECK_ACCESS(_res_ptr);
30560         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
30561         FREE(untag_ptr(_res));
30562         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
30563 }
30564
30565 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30566         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30567         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
30568         return tag_ptr(ret_conv, true);
30569 }
30570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30571         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30572         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30573         return ret_conv;
30574 }
30575
30576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30577         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30578         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30579         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
30580         return tag_ptr(ret_conv, true);
30581 }
30582
30583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30584         LDKNodeAnnouncement o_conv;
30585         o_conv.inner = untag_ptr(o);
30586         o_conv.is_owned = ptr_is_owned(o);
30587         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30588         o_conv = NodeAnnouncement_clone(&o_conv);
30589         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30590         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
30591         return tag_ptr(ret_conv, true);
30592 }
30593
30594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30595         void* e_ptr = untag_ptr(e);
30596         CHECK_ACCESS(e_ptr);
30597         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30598         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30599         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30600         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
30601         return tag_ptr(ret_conv, true);
30602 }
30603
30604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30605         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30606         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30607         return ret_conv;
30608 }
30609
30610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30611         if (!ptr_is_owned(_res)) return;
30612         void* _res_ptr = untag_ptr(_res);
30613         CHECK_ACCESS(_res_ptr);
30614         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
30615         FREE(untag_ptr(_res));
30616         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
30617 }
30618
30619 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30620         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30621         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
30622         return tag_ptr(ret_conv, true);
30623 }
30624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30625         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30626         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30627         return ret_conv;
30628 }
30629
30630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30631         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30632         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30633         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
30634         return tag_ptr(ret_conv, true);
30635 }
30636
30637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30638         LDKQueryShortChannelIds o_conv;
30639         o_conv.inner = untag_ptr(o);
30640         o_conv.is_owned = ptr_is_owned(o);
30641         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30642         o_conv = QueryShortChannelIds_clone(&o_conv);
30643         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30644         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
30645         return tag_ptr(ret_conv, true);
30646 }
30647
30648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30649         void* e_ptr = untag_ptr(e);
30650         CHECK_ACCESS(e_ptr);
30651         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30652         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30653         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30654         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
30655         return tag_ptr(ret_conv, true);
30656 }
30657
30658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30659         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
30660         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
30661         return ret_conv;
30662 }
30663
30664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30665         if (!ptr_is_owned(_res)) return;
30666         void* _res_ptr = untag_ptr(_res);
30667         CHECK_ACCESS(_res_ptr);
30668         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
30669         FREE(untag_ptr(_res));
30670         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
30671 }
30672
30673 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
30674         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30675         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
30676         return tag_ptr(ret_conv, true);
30677 }
30678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30679         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
30680         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
30681         return ret_conv;
30682 }
30683
30684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30685         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
30686         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30687         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
30688         return tag_ptr(ret_conv, true);
30689 }
30690
30691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30692         LDKReplyShortChannelIdsEnd o_conv;
30693         o_conv.inner = untag_ptr(o);
30694         o_conv.is_owned = ptr_is_owned(o);
30695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30696         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
30697         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30698         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
30699         return tag_ptr(ret_conv, true);
30700 }
30701
30702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30703         void* e_ptr = untag_ptr(e);
30704         CHECK_ACCESS(e_ptr);
30705         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30706         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30707         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30708         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
30709         return tag_ptr(ret_conv, true);
30710 }
30711
30712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30713         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
30714         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
30715         return ret_conv;
30716 }
30717
30718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30719         if (!ptr_is_owned(_res)) return;
30720         void* _res_ptr = untag_ptr(_res);
30721         CHECK_ACCESS(_res_ptr);
30722         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
30723         FREE(untag_ptr(_res));
30724         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
30725 }
30726
30727 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
30728         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30729         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
30730         return tag_ptr(ret_conv, true);
30731 }
30732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30733         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
30734         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
30735         return ret_conv;
30736 }
30737
30738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30739         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
30740         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30741         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
30742         return tag_ptr(ret_conv, true);
30743 }
30744
30745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30746         LDKQueryChannelRange o_conv;
30747         o_conv.inner = untag_ptr(o);
30748         o_conv.is_owned = ptr_is_owned(o);
30749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30750         o_conv = QueryChannelRange_clone(&o_conv);
30751         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30752         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
30753         return tag_ptr(ret_conv, true);
30754 }
30755
30756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30757         void* e_ptr = untag_ptr(e);
30758         CHECK_ACCESS(e_ptr);
30759         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30760         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30761         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30762         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
30763         return tag_ptr(ret_conv, true);
30764 }
30765
30766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30767         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
30768         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
30769         return ret_conv;
30770 }
30771
30772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30773         if (!ptr_is_owned(_res)) return;
30774         void* _res_ptr = untag_ptr(_res);
30775         CHECK_ACCESS(_res_ptr);
30776         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
30777         FREE(untag_ptr(_res));
30778         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
30779 }
30780
30781 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30782         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30783         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
30784         return tag_ptr(ret_conv, true);
30785 }
30786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30787         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
30788         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30789         return ret_conv;
30790 }
30791
30792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30793         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
30794         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30795         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
30796         return tag_ptr(ret_conv, true);
30797 }
30798
30799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30800         LDKReplyChannelRange o_conv;
30801         o_conv.inner = untag_ptr(o);
30802         o_conv.is_owned = ptr_is_owned(o);
30803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30804         o_conv = ReplyChannelRange_clone(&o_conv);
30805         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30806         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
30807         return tag_ptr(ret_conv, true);
30808 }
30809
30810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30811         void* e_ptr = untag_ptr(e);
30812         CHECK_ACCESS(e_ptr);
30813         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30814         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30815         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30816         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
30817         return tag_ptr(ret_conv, true);
30818 }
30819
30820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30821         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
30822         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
30823         return ret_conv;
30824 }
30825
30826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30827         if (!ptr_is_owned(_res)) return;
30828         void* _res_ptr = untag_ptr(_res);
30829         CHECK_ACCESS(_res_ptr);
30830         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
30831         FREE(untag_ptr(_res));
30832         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
30833 }
30834
30835 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30836         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30837         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
30838         return tag_ptr(ret_conv, true);
30839 }
30840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30841         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
30842         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30843         return ret_conv;
30844 }
30845
30846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30847         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
30848         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30849         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
30850         return tag_ptr(ret_conv, true);
30851 }
30852
30853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30854         LDKGossipTimestampFilter o_conv;
30855         o_conv.inner = untag_ptr(o);
30856         o_conv.is_owned = ptr_is_owned(o);
30857         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30858         o_conv = GossipTimestampFilter_clone(&o_conv);
30859         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30860         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
30861         return tag_ptr(ret_conv, true);
30862 }
30863
30864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30865         void* e_ptr = untag_ptr(e);
30866         CHECK_ACCESS(e_ptr);
30867         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30868         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30869         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30870         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
30871         return tag_ptr(ret_conv, true);
30872 }
30873
30874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30875         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
30876         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
30877         return ret_conv;
30878 }
30879
30880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30881         if (!ptr_is_owned(_res)) return;
30882         void* _res_ptr = untag_ptr(_res);
30883         CHECK_ACCESS(_res_ptr);
30884         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
30885         FREE(untag_ptr(_res));
30886         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
30887 }
30888
30889 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
30890         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30891         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
30892         return tag_ptr(ret_conv, true);
30893 }
30894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30895         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
30896         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
30897         return ret_conv;
30898 }
30899
30900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30901         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
30902         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30903         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
30904         return tag_ptr(ret_conv, true);
30905 }
30906
30907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30908         LDKCVec_PhantomRouteHintsZ _res_constr;
30909         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30910         if (_res_constr.datalen > 0)
30911                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
30912         else
30913                 _res_constr.data = NULL;
30914         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30915         for (size_t t = 0; t < _res_constr.datalen; t++) {
30916                 int64_t _res_conv_19 = _res_vals[t];
30917                 LDKPhantomRouteHints _res_conv_19_conv;
30918                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
30919                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
30920                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
30921                 _res_constr.data[t] = _res_conv_19_conv;
30922         }
30923         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30924         CVec_PhantomRouteHintsZ_free(_res_constr);
30925 }
30926
30927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30928         LDKBolt11Invoice o_conv;
30929         o_conv.inner = untag_ptr(o);
30930         o_conv.is_owned = ptr_is_owned(o);
30931         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30932         o_conv = Bolt11Invoice_clone(&o_conv);
30933         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30934         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
30935         return tag_ptr(ret_conv, true);
30936 }
30937
30938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30939         void* e_ptr = untag_ptr(e);
30940         CHECK_ACCESS(e_ptr);
30941         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
30942         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
30943         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30944         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
30945         return tag_ptr(ret_conv, true);
30946 }
30947
30948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30949         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
30950         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
30951         return ret_conv;
30952 }
30953
30954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30955         if (!ptr_is_owned(_res)) return;
30956         void* _res_ptr = untag_ptr(_res);
30957         CHECK_ACCESS(_res_ptr);
30958         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
30959         FREE(untag_ptr(_res));
30960         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
30961 }
30962
30963 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
30964         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30965         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
30966         return tag_ptr(ret_conv, true);
30967 }
30968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30969         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
30970         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
30971         return ret_conv;
30972 }
30973
30974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30975         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
30976         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30977         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
30978         return tag_ptr(ret_conv, true);
30979 }
30980
30981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30982         LDKCVec_FutureZ _res_constr;
30983         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30984         if (_res_constr.datalen > 0)
30985                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
30986         else
30987                 _res_constr.data = NULL;
30988         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30989         for (size_t i = 0; i < _res_constr.datalen; i++) {
30990                 int64_t _res_conv_8 = _res_vals[i];
30991                 LDKFuture _res_conv_8_conv;
30992                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
30993                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
30994                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
30995                 _res_constr.data[i] = _res_conv_8_conv;
30996         }
30997         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30998         CVec_FutureZ_free(_res_constr);
30999 }
31000
31001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31002         void* o_ptr = untag_ptr(o);
31003         CHECK_ACCESS(o_ptr);
31004         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
31005         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
31006         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31007         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
31008         return tag_ptr(ret_conv, true);
31009 }
31010
31011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31012         void* e_ptr = untag_ptr(e);
31013         CHECK_ACCESS(e_ptr);
31014         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31015         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31016         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31017         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
31018         return tag_ptr(ret_conv, true);
31019 }
31020
31021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31022         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
31023         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
31024         return ret_conv;
31025 }
31026
31027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31028         if (!ptr_is_owned(_res)) return;
31029         void* _res_ptr = untag_ptr(_res);
31030         CHECK_ACCESS(_res_ptr);
31031         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
31032         FREE(untag_ptr(_res));
31033         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
31034 }
31035
31036 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
31037         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31038         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
31039         return tag_ptr(ret_conv, true);
31040 }
31041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31042         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
31043         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
31044         return ret_conv;
31045 }
31046
31047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31048         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
31049         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31050         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
31051         return tag_ptr(ret_conv, true);
31052 }
31053
31054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
31055         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
31056         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31057         *ret_copy = COption_HTLCClaimZ_some(o_conv);
31058         int64_t ret_ref = tag_ptr(ret_copy, true);
31059         return ret_ref;
31060 }
31061
31062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
31063         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31064         *ret_copy = COption_HTLCClaimZ_none();
31065         int64_t ret_ref = tag_ptr(ret_copy, true);
31066         return ret_ref;
31067 }
31068
31069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31070         if (!ptr_is_owned(_res)) return;
31071         void* _res_ptr = untag_ptr(_res);
31072         CHECK_ACCESS(_res_ptr);
31073         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
31074         FREE(untag_ptr(_res));
31075         COption_HTLCClaimZ_free(_res_conv);
31076 }
31077
31078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31079         LDKCounterpartyCommitmentSecrets o_conv;
31080         o_conv.inner = untag_ptr(o);
31081         o_conv.is_owned = ptr_is_owned(o);
31082         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31083         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
31084         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31085         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
31086         return tag_ptr(ret_conv, true);
31087 }
31088
31089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31090         void* e_ptr = untag_ptr(e);
31091         CHECK_ACCESS(e_ptr);
31092         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31093         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31094         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31095         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
31096         return tag_ptr(ret_conv, true);
31097 }
31098
31099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31100         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
31101         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
31102         return ret_conv;
31103 }
31104
31105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31106         if (!ptr_is_owned(_res)) return;
31107         void* _res_ptr = untag_ptr(_res);
31108         CHECK_ACCESS(_res_ptr);
31109         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
31110         FREE(untag_ptr(_res));
31111         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
31112 }
31113
31114 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
31115         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31116         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
31117         return tag_ptr(ret_conv, true);
31118 }
31119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31120         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
31121         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
31122         return ret_conv;
31123 }
31124
31125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31126         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
31127         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31128         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
31129         return tag_ptr(ret_conv, true);
31130 }
31131
31132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31133         LDKTxCreationKeys o_conv;
31134         o_conv.inner = untag_ptr(o);
31135         o_conv.is_owned = ptr_is_owned(o);
31136         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31137         o_conv = TxCreationKeys_clone(&o_conv);
31138         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31139         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
31140         return tag_ptr(ret_conv, true);
31141 }
31142
31143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31144         void* e_ptr = untag_ptr(e);
31145         CHECK_ACCESS(e_ptr);
31146         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31147         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31148         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31149         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
31150         return tag_ptr(ret_conv, true);
31151 }
31152
31153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31154         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
31155         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
31156         return ret_conv;
31157 }
31158
31159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31160         if (!ptr_is_owned(_res)) return;
31161         void* _res_ptr = untag_ptr(_res);
31162         CHECK_ACCESS(_res_ptr);
31163         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
31164         FREE(untag_ptr(_res));
31165         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
31166 }
31167
31168 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
31169         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31170         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
31171         return tag_ptr(ret_conv, true);
31172 }
31173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31174         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
31175         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
31176         return ret_conv;
31177 }
31178
31179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31180         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
31181         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31182         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
31183         return tag_ptr(ret_conv, true);
31184 }
31185
31186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31187         LDKChannelPublicKeys o_conv;
31188         o_conv.inner = untag_ptr(o);
31189         o_conv.is_owned = ptr_is_owned(o);
31190         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31191         o_conv = ChannelPublicKeys_clone(&o_conv);
31192         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31193         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
31194         return tag_ptr(ret_conv, true);
31195 }
31196
31197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31198         void* e_ptr = untag_ptr(e);
31199         CHECK_ACCESS(e_ptr);
31200         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31201         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31202         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31203         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
31204         return tag_ptr(ret_conv, true);
31205 }
31206
31207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31208         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
31209         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
31210         return ret_conv;
31211 }
31212
31213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31214         if (!ptr_is_owned(_res)) return;
31215         void* _res_ptr = untag_ptr(_res);
31216         CHECK_ACCESS(_res_ptr);
31217         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
31218         FREE(untag_ptr(_res));
31219         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
31220 }
31221
31222 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
31223         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31224         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
31225         return tag_ptr(ret_conv, true);
31226 }
31227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31228         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
31229         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
31230         return ret_conv;
31231 }
31232
31233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31234         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
31235         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31236         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
31237         return tag_ptr(ret_conv, true);
31238 }
31239
31240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31241         LDKHTLCOutputInCommitment o_conv;
31242         o_conv.inner = untag_ptr(o);
31243         o_conv.is_owned = ptr_is_owned(o);
31244         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31245         o_conv = HTLCOutputInCommitment_clone(&o_conv);
31246         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31247         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
31248         return tag_ptr(ret_conv, true);
31249 }
31250
31251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31252         void* e_ptr = untag_ptr(e);
31253         CHECK_ACCESS(e_ptr);
31254         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31255         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31256         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31257         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
31258         return tag_ptr(ret_conv, true);
31259 }
31260
31261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31262         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
31263         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
31264         return ret_conv;
31265 }
31266
31267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31268         if (!ptr_is_owned(_res)) return;
31269         void* _res_ptr = untag_ptr(_res);
31270         CHECK_ACCESS(_res_ptr);
31271         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
31272         FREE(untag_ptr(_res));
31273         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
31274 }
31275
31276 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
31277         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31278         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
31279         return tag_ptr(ret_conv, true);
31280 }
31281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31282         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
31283         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
31284         return ret_conv;
31285 }
31286
31287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31288         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
31289         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31290         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
31291         return tag_ptr(ret_conv, true);
31292 }
31293
31294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31295         LDKCounterpartyChannelTransactionParameters o_conv;
31296         o_conv.inner = untag_ptr(o);
31297         o_conv.is_owned = ptr_is_owned(o);
31298         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31299         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
31300         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31301         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31302         return tag_ptr(ret_conv, true);
31303 }
31304
31305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31306         void* e_ptr = untag_ptr(e);
31307         CHECK_ACCESS(e_ptr);
31308         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31309         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31310         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31311         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
31312         return tag_ptr(ret_conv, true);
31313 }
31314
31315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31316         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31317         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31318         return ret_conv;
31319 }
31320
31321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31322         if (!ptr_is_owned(_res)) return;
31323         void* _res_ptr = untag_ptr(_res);
31324         CHECK_ACCESS(_res_ptr);
31325         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31326         FREE(untag_ptr(_res));
31327         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31328 }
31329
31330 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31331         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31332         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
31333         return tag_ptr(ret_conv, true);
31334 }
31335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31336         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31337         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31338         return ret_conv;
31339 }
31340
31341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31342         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31343         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31344         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31345         return tag_ptr(ret_conv, true);
31346 }
31347
31348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31349         LDKChannelTransactionParameters o_conv;
31350         o_conv.inner = untag_ptr(o);
31351         o_conv.is_owned = ptr_is_owned(o);
31352         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31353         o_conv = ChannelTransactionParameters_clone(&o_conv);
31354         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31355         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31356         return tag_ptr(ret_conv, true);
31357 }
31358
31359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31360         void* e_ptr = untag_ptr(e);
31361         CHECK_ACCESS(e_ptr);
31362         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31363         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31364         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31365         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
31366         return tag_ptr(ret_conv, true);
31367 }
31368
31369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31370         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31371         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31372         return ret_conv;
31373 }
31374
31375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31376         if (!ptr_is_owned(_res)) return;
31377         void* _res_ptr = untag_ptr(_res);
31378         CHECK_ACCESS(_res_ptr);
31379         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31380         FREE(untag_ptr(_res));
31381         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31382 }
31383
31384 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31385         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31386         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
31387         return tag_ptr(ret_conv, true);
31388 }
31389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31390         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31391         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31392         return ret_conv;
31393 }
31394
31395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31396         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31397         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31398         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31399         return tag_ptr(ret_conv, true);
31400 }
31401
31402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31403         LDKHolderCommitmentTransaction o_conv;
31404         o_conv.inner = untag_ptr(o);
31405         o_conv.is_owned = ptr_is_owned(o);
31406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31407         o_conv = HolderCommitmentTransaction_clone(&o_conv);
31408         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31409         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
31410         return tag_ptr(ret_conv, true);
31411 }
31412
31413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31414         void* e_ptr = untag_ptr(e);
31415         CHECK_ACCESS(e_ptr);
31416         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31417         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31418         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31419         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
31420         return tag_ptr(ret_conv, true);
31421 }
31422
31423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31424         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31425         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31426         return ret_conv;
31427 }
31428
31429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31430         if (!ptr_is_owned(_res)) return;
31431         void* _res_ptr = untag_ptr(_res);
31432         CHECK_ACCESS(_res_ptr);
31433         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31434         FREE(untag_ptr(_res));
31435         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
31436 }
31437
31438 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31439         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31440         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
31441         return tag_ptr(ret_conv, true);
31442 }
31443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31444         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31445         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31446         return ret_conv;
31447 }
31448
31449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31450         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31451         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31452         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31453         return tag_ptr(ret_conv, true);
31454 }
31455
31456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31457         LDKBuiltCommitmentTransaction o_conv;
31458         o_conv.inner = untag_ptr(o);
31459         o_conv.is_owned = ptr_is_owned(o);
31460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31461         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
31462         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31463         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
31464         return tag_ptr(ret_conv, true);
31465 }
31466
31467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31468         void* e_ptr = untag_ptr(e);
31469         CHECK_ACCESS(e_ptr);
31470         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31471         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31472         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31473         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
31474         return tag_ptr(ret_conv, true);
31475 }
31476
31477 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31478         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31479         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31480         return ret_conv;
31481 }
31482
31483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31484         if (!ptr_is_owned(_res)) return;
31485         void* _res_ptr = untag_ptr(_res);
31486         CHECK_ACCESS(_res_ptr);
31487         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31488         FREE(untag_ptr(_res));
31489         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
31490 }
31491
31492 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31493         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31494         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
31495         return tag_ptr(ret_conv, true);
31496 }
31497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31498         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31499         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31500         return ret_conv;
31501 }
31502
31503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31504         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31505         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31506         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31507         return tag_ptr(ret_conv, true);
31508 }
31509
31510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31511         LDKTrustedClosingTransaction o_conv;
31512         o_conv.inner = untag_ptr(o);
31513         o_conv.is_owned = ptr_is_owned(o);
31514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31515         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
31516         
31517         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31518         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
31519         return tag_ptr(ret_conv, true);
31520 }
31521
31522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
31523         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31524         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
31525         return tag_ptr(ret_conv, true);
31526 }
31527
31528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31529         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
31530         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
31531         return ret_conv;
31532 }
31533
31534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31535         if (!ptr_is_owned(_res)) return;
31536         void* _res_ptr = untag_ptr(_res);
31537         CHECK_ACCESS(_res_ptr);
31538         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
31539         FREE(untag_ptr(_res));
31540         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
31541 }
31542
31543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31544         LDKCommitmentTransaction o_conv;
31545         o_conv.inner = untag_ptr(o);
31546         o_conv.is_owned = ptr_is_owned(o);
31547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31548         o_conv = CommitmentTransaction_clone(&o_conv);
31549         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31550         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
31551         return tag_ptr(ret_conv, true);
31552 }
31553
31554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31555         void* e_ptr = untag_ptr(e);
31556         CHECK_ACCESS(e_ptr);
31557         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31558         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31559         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31560         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
31561         return tag_ptr(ret_conv, true);
31562 }
31563
31564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31565         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31566         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31567         return ret_conv;
31568 }
31569
31570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31571         if (!ptr_is_owned(_res)) return;
31572         void* _res_ptr = untag_ptr(_res);
31573         CHECK_ACCESS(_res_ptr);
31574         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
31575         FREE(untag_ptr(_res));
31576         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
31577 }
31578
31579 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31580         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31581         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
31582         return tag_ptr(ret_conv, true);
31583 }
31584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31585         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31586         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31587         return ret_conv;
31588 }
31589
31590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31591         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31592         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31593         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
31594         return tag_ptr(ret_conv, true);
31595 }
31596
31597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31598         LDKTrustedCommitmentTransaction o_conv;
31599         o_conv.inner = untag_ptr(o);
31600         o_conv.is_owned = ptr_is_owned(o);
31601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31602         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
31603         
31604         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31605         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
31606         return tag_ptr(ret_conv, true);
31607 }
31608
31609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
31610         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31611         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
31612         return tag_ptr(ret_conv, true);
31613 }
31614
31615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31616         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
31617         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
31618         return ret_conv;
31619 }
31620
31621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31622         if (!ptr_is_owned(_res)) return;
31623         void* _res_ptr = untag_ptr(_res);
31624         CHECK_ACCESS(_res_ptr);
31625         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
31626         FREE(untag_ptr(_res));
31627         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
31628 }
31629
31630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
31631         LDKCVec_ECDSASignatureZ o_constr;
31632         o_constr.datalen = (*env)->GetArrayLength(env, o);
31633         if (o_constr.datalen > 0)
31634                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
31635         else
31636                 o_constr.data = NULL;
31637         for (size_t i = 0; i < o_constr.datalen; i++) {
31638                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
31639                 LDKECDSASignature o_conv_8_ref;
31640                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
31641                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
31642                 o_constr.data[i] = o_conv_8_ref;
31643         }
31644         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31645         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
31646         return tag_ptr(ret_conv, true);
31647 }
31648
31649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
31650         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31651         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
31652         return tag_ptr(ret_conv, true);
31653 }
31654
31655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31656         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
31657         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
31658         return ret_conv;
31659 }
31660
31661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31662         if (!ptr_is_owned(_res)) return;
31663         void* _res_ptr = untag_ptr(_res);
31664         CHECK_ACCESS(_res_ptr);
31665         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
31666         FREE(untag_ptr(_res));
31667         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
31668 }
31669
31670 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
31671         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31672         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
31673         return tag_ptr(ret_conv, true);
31674 }
31675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31676         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
31677         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
31678         return ret_conv;
31679 }
31680
31681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31682         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
31683         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31684         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
31685         return tag_ptr(ret_conv, true);
31686 }
31687
31688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31689         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31690         *ret_copy = COption_usizeZ_some(o);
31691         int64_t ret_ref = tag_ptr(ret_copy, true);
31692         return ret_ref;
31693 }
31694
31695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1none(JNIEnv *env, jclass clz) {
31696         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31697         *ret_copy = COption_usizeZ_none();
31698         int64_t ret_ref = tag_ptr(ret_copy, true);
31699         return ret_ref;
31700 }
31701
31702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31703         if (!ptr_is_owned(_res)) return;
31704         void* _res_ptr = untag_ptr(_res);
31705         CHECK_ACCESS(_res_ptr);
31706         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
31707         FREE(untag_ptr(_res));
31708         COption_usizeZ_free(_res_conv);
31709 }
31710
31711 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
31712         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31713         *ret_copy = COption_usizeZ_clone(arg);
31714         int64_t ret_ref = tag_ptr(ret_copy, true);
31715         return ret_ref;
31716 }
31717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31718         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
31719         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
31720         return ret_conv;
31721 }
31722
31723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31724         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
31725         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31726         *ret_copy = COption_usizeZ_clone(orig_conv);
31727         int64_t ret_ref = tag_ptr(ret_copy, true);
31728         return ret_ref;
31729 }
31730
31731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31732         LDKShutdownScript o_conv;
31733         o_conv.inner = untag_ptr(o);
31734         o_conv.is_owned = ptr_is_owned(o);
31735         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31736         o_conv = ShutdownScript_clone(&o_conv);
31737         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31738         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
31739         return tag_ptr(ret_conv, true);
31740 }
31741
31742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31743         void* e_ptr = untag_ptr(e);
31744         CHECK_ACCESS(e_ptr);
31745         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31746         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31747         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31748         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
31749         return tag_ptr(ret_conv, true);
31750 }
31751
31752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31753         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
31754         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
31755         return ret_conv;
31756 }
31757
31758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31759         if (!ptr_is_owned(_res)) return;
31760         void* _res_ptr = untag_ptr(_res);
31761         CHECK_ACCESS(_res_ptr);
31762         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
31763         FREE(untag_ptr(_res));
31764         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
31765 }
31766
31767 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
31768         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31769         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
31770         return tag_ptr(ret_conv, true);
31771 }
31772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31773         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
31774         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
31775         return ret_conv;
31776 }
31777
31778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31779         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
31780         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31781         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
31782         return tag_ptr(ret_conv, true);
31783 }
31784
31785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31786         LDKShutdownScript o_conv;
31787         o_conv.inner = untag_ptr(o);
31788         o_conv.is_owned = ptr_is_owned(o);
31789         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31790         o_conv = ShutdownScript_clone(&o_conv);
31791         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31792         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
31793         return tag_ptr(ret_conv, true);
31794 }
31795
31796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31797         LDKInvalidShutdownScript e_conv;
31798         e_conv.inner = untag_ptr(e);
31799         e_conv.is_owned = ptr_is_owned(e);
31800         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
31801         e_conv = InvalidShutdownScript_clone(&e_conv);
31802         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31803         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
31804         return tag_ptr(ret_conv, true);
31805 }
31806
31807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31808         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
31809         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
31810         return ret_conv;
31811 }
31812
31813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31814         if (!ptr_is_owned(_res)) return;
31815         void* _res_ptr = untag_ptr(_res);
31816         CHECK_ACCESS(_res_ptr);
31817         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
31818         FREE(untag_ptr(_res));
31819         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
31820 }
31821
31822 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
31823         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31824         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
31825         return tag_ptr(ret_conv, true);
31826 }
31827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31828         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
31829         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
31830         return ret_conv;
31831 }
31832
31833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31834         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
31835         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31836         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
31837         return tag_ptr(ret_conv, true);
31838 }
31839
31840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31841         void* o_ptr = untag_ptr(o);
31842         CHECK_ACCESS(o_ptr);
31843         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
31844         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
31845         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31846         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
31847         return tag_ptr(ret_conv, true);
31848 }
31849
31850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31851         void* e_ptr = untag_ptr(e);
31852         CHECK_ACCESS(e_ptr);
31853         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31854         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31855         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31856         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
31857         return tag_ptr(ret_conv, true);
31858 }
31859
31860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31861         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
31862         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
31863         return ret_conv;
31864 }
31865
31866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31867         if (!ptr_is_owned(_res)) return;
31868         void* _res_ptr = untag_ptr(_res);
31869         CHECK_ACCESS(_res_ptr);
31870         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
31871         FREE(untag_ptr(_res));
31872         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
31873 }
31874
31875 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
31876         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31877         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
31878         return tag_ptr(ret_conv, true);
31879 }
31880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31881         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
31882         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
31883         return ret_conv;
31884 }
31885
31886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31887         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
31888         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31889         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
31890         return tag_ptr(ret_conv, true);
31891 }
31892
31893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31894         LDKClaimedHTLC o_conv;
31895         o_conv.inner = untag_ptr(o);
31896         o_conv.is_owned = ptr_is_owned(o);
31897         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31898         o_conv = ClaimedHTLC_clone(&o_conv);
31899         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31900         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
31901         return tag_ptr(ret_conv, true);
31902 }
31903
31904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31905         void* e_ptr = untag_ptr(e);
31906         CHECK_ACCESS(e_ptr);
31907         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31908         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31909         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31910         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
31911         return tag_ptr(ret_conv, true);
31912 }
31913
31914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31915         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
31916         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
31917         return ret_conv;
31918 }
31919
31920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31921         if (!ptr_is_owned(_res)) return;
31922         void* _res_ptr = untag_ptr(_res);
31923         CHECK_ACCESS(_res_ptr);
31924         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
31925         FREE(untag_ptr(_res));
31926         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
31927 }
31928
31929 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
31930         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31931         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
31932         return tag_ptr(ret_conv, true);
31933 }
31934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31935         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
31936         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
31937         return ret_conv;
31938 }
31939
31940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31941         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
31942         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31943         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
31944         return tag_ptr(ret_conv, true);
31945 }
31946
31947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31948         void* o_ptr = untag_ptr(o);
31949         CHECK_ACCESS(o_ptr);
31950         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
31951         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
31952         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31953         *ret_copy = COption_PathFailureZ_some(o_conv);
31954         int64_t ret_ref = tag_ptr(ret_copy, true);
31955         return ret_ref;
31956 }
31957
31958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
31959         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31960         *ret_copy = COption_PathFailureZ_none();
31961         int64_t ret_ref = tag_ptr(ret_copy, true);
31962         return ret_ref;
31963 }
31964
31965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31966         if (!ptr_is_owned(_res)) return;
31967         void* _res_ptr = untag_ptr(_res);
31968         CHECK_ACCESS(_res_ptr);
31969         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
31970         FREE(untag_ptr(_res));
31971         COption_PathFailureZ_free(_res_conv);
31972 }
31973
31974 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
31975         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31976         *ret_copy = COption_PathFailureZ_clone(arg);
31977         int64_t ret_ref = tag_ptr(ret_copy, true);
31978         return ret_ref;
31979 }
31980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31981         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
31982         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
31983         return ret_conv;
31984 }
31985
31986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31987         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
31988         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31989         *ret_copy = COption_PathFailureZ_clone(orig_conv);
31990         int64_t ret_ref = tag_ptr(ret_copy, true);
31991         return ret_ref;
31992 }
31993
31994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31995         void* o_ptr = untag_ptr(o);
31996         CHECK_ACCESS(o_ptr);
31997         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
31998         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
31999         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32000         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
32001         return tag_ptr(ret_conv, true);
32002 }
32003
32004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32005         void* e_ptr = untag_ptr(e);
32006         CHECK_ACCESS(e_ptr);
32007         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32008         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32009         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32010         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
32011         return tag_ptr(ret_conv, true);
32012 }
32013
32014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32015         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
32016         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
32017         return ret_conv;
32018 }
32019
32020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32021         if (!ptr_is_owned(_res)) return;
32022         void* _res_ptr = untag_ptr(_res);
32023         CHECK_ACCESS(_res_ptr);
32024         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
32025         FREE(untag_ptr(_res));
32026         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
32027 }
32028
32029 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
32030         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32031         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
32032         return tag_ptr(ret_conv, true);
32033 }
32034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32035         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
32036         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
32037         return ret_conv;
32038 }
32039
32040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32041         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
32042         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32043         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
32044         return tag_ptr(ret_conv, true);
32045 }
32046
32047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32048         void* o_ptr = untag_ptr(o);
32049         CHECK_ACCESS(o_ptr);
32050         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
32051         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
32052         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32053         *ret_copy = COption_ClosureReasonZ_some(o_conv);
32054         int64_t ret_ref = tag_ptr(ret_copy, true);
32055         return ret_ref;
32056 }
32057
32058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
32059         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32060         *ret_copy = COption_ClosureReasonZ_none();
32061         int64_t ret_ref = tag_ptr(ret_copy, true);
32062         return ret_ref;
32063 }
32064
32065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32066         if (!ptr_is_owned(_res)) return;
32067         void* _res_ptr = untag_ptr(_res);
32068         CHECK_ACCESS(_res_ptr);
32069         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
32070         FREE(untag_ptr(_res));
32071         COption_ClosureReasonZ_free(_res_conv);
32072 }
32073
32074 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
32075         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32076         *ret_copy = COption_ClosureReasonZ_clone(arg);
32077         int64_t ret_ref = tag_ptr(ret_copy, true);
32078         return ret_ref;
32079 }
32080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32081         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
32082         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
32083         return ret_conv;
32084 }
32085
32086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32087         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
32088         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32089         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
32090         int64_t ret_ref = tag_ptr(ret_copy, true);
32091         return ret_ref;
32092 }
32093
32094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32095         void* o_ptr = untag_ptr(o);
32096         CHECK_ACCESS(o_ptr);
32097         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
32098         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
32099         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32100         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
32101         return tag_ptr(ret_conv, true);
32102 }
32103
32104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32105         void* e_ptr = untag_ptr(e);
32106         CHECK_ACCESS(e_ptr);
32107         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32108         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32109         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32110         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
32111         return tag_ptr(ret_conv, true);
32112 }
32113
32114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32115         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
32116         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
32117         return ret_conv;
32118 }
32119
32120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32121         if (!ptr_is_owned(_res)) return;
32122         void* _res_ptr = untag_ptr(_res);
32123         CHECK_ACCESS(_res_ptr);
32124         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
32125         FREE(untag_ptr(_res));
32126         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
32127 }
32128
32129 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
32130         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32131         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
32132         return tag_ptr(ret_conv, true);
32133 }
32134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32135         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
32136         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
32137         return ret_conv;
32138 }
32139
32140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32141         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
32142         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32143         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
32144         return tag_ptr(ret_conv, true);
32145 }
32146
32147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32148         void* o_ptr = untag_ptr(o);
32149         CHECK_ACCESS(o_ptr);
32150         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
32151         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
32152         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32153         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
32154         int64_t ret_ref = tag_ptr(ret_copy, true);
32155         return ret_ref;
32156 }
32157
32158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
32159         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32160         *ret_copy = COption_HTLCDestinationZ_none();
32161         int64_t ret_ref = tag_ptr(ret_copy, true);
32162         return ret_ref;
32163 }
32164
32165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32166         if (!ptr_is_owned(_res)) return;
32167         void* _res_ptr = untag_ptr(_res);
32168         CHECK_ACCESS(_res_ptr);
32169         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
32170         FREE(untag_ptr(_res));
32171         COption_HTLCDestinationZ_free(_res_conv);
32172 }
32173
32174 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
32175         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32176         *ret_copy = COption_HTLCDestinationZ_clone(arg);
32177         int64_t ret_ref = tag_ptr(ret_copy, true);
32178         return ret_ref;
32179 }
32180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32181         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
32182         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
32183         return ret_conv;
32184 }
32185
32186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32187         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
32188         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32189         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
32190         int64_t ret_ref = tag_ptr(ret_copy, true);
32191         return ret_ref;
32192 }
32193
32194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32195         void* o_ptr = untag_ptr(o);
32196         CHECK_ACCESS(o_ptr);
32197         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
32198         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
32199         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32200         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
32201         return tag_ptr(ret_conv, true);
32202 }
32203
32204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32205         void* e_ptr = untag_ptr(e);
32206         CHECK_ACCESS(e_ptr);
32207         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32208         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32209         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32210         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
32211         return tag_ptr(ret_conv, true);
32212 }
32213
32214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32215         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
32216         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
32217         return ret_conv;
32218 }
32219
32220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32221         if (!ptr_is_owned(_res)) return;
32222         void* _res_ptr = untag_ptr(_res);
32223         CHECK_ACCESS(_res_ptr);
32224         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
32225         FREE(untag_ptr(_res));
32226         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
32227 }
32228
32229 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
32230         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32231         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
32232         return tag_ptr(ret_conv, true);
32233 }
32234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32235         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
32236         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
32237         return ret_conv;
32238 }
32239
32240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32241         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
32242         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32243         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
32244         return tag_ptr(ret_conv, true);
32245 }
32246
32247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
32248         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
32249         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32250         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
32251         return tag_ptr(ret_conv, true);
32252 }
32253
32254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32255         void* e_ptr = untag_ptr(e);
32256         CHECK_ACCESS(e_ptr);
32257         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32258         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32259         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32260         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
32261         return tag_ptr(ret_conv, true);
32262 }
32263
32264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32265         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
32266         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
32267         return ret_conv;
32268 }
32269
32270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32271         if (!ptr_is_owned(_res)) return;
32272         void* _res_ptr = untag_ptr(_res);
32273         CHECK_ACCESS(_res_ptr);
32274         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
32275         FREE(untag_ptr(_res));
32276         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
32277 }
32278
32279 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
32280         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32281         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
32282         return tag_ptr(ret_conv, true);
32283 }
32284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32285         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
32286         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
32287         return ret_conv;
32288 }
32289
32290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32291         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
32292         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32293         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
32294         return tag_ptr(ret_conv, true);
32295 }
32296
32297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
32298         LDKU128 o_ref;
32299         CHECK((*env)->GetArrayLength(env, o) == 16);
32300         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
32301         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32302         *ret_copy = COption_U128Z_some(o_ref);
32303         int64_t ret_ref = tag_ptr(ret_copy, true);
32304         return ret_ref;
32305 }
32306
32307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1none(JNIEnv *env, jclass clz) {
32308         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32309         *ret_copy = COption_U128Z_none();
32310         int64_t ret_ref = tag_ptr(ret_copy, true);
32311         return ret_ref;
32312 }
32313
32314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
32315         if (!ptr_is_owned(_res)) return;
32316         void* _res_ptr = untag_ptr(_res);
32317         CHECK_ACCESS(_res_ptr);
32318         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
32319         FREE(untag_ptr(_res));
32320         COption_U128Z_free(_res_conv);
32321 }
32322
32323 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
32324         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32325         *ret_copy = COption_U128Z_clone(arg);
32326         int64_t ret_ref = tag_ptr(ret_copy, true);
32327         return ret_ref;
32328 }
32329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32330         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
32331         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
32332         return ret_conv;
32333 }
32334
32335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32336         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
32337         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32338         *ret_copy = COption_U128Z_clone(orig_conv);
32339         int64_t ret_ref = tag_ptr(ret_copy, true);
32340         return ret_ref;
32341 }
32342
32343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ClaimedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32344         LDKCVec_ClaimedHTLCZ _res_constr;
32345         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32346         if (_res_constr.datalen > 0)
32347                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
32348         else
32349                 _res_constr.data = NULL;
32350         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32351         for (size_t n = 0; n < _res_constr.datalen; n++) {
32352                 int64_t _res_conv_13 = _res_vals[n];
32353                 LDKClaimedHTLC _res_conv_13_conv;
32354                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32355                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32356                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32357                 _res_constr.data[n] = _res_conv_13_conv;
32358         }
32359         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32360         CVec_ClaimedHTLCZ_free(_res_constr);
32361 }
32362
32363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
32364         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
32365         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32366         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
32367         int64_t ret_ref = tag_ptr(ret_copy, true);
32368         return ret_ref;
32369 }
32370
32371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
32372         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32373         *ret_copy = COption_PaymentFailureReasonZ_none();
32374         int64_t ret_ref = tag_ptr(ret_copy, true);
32375         return ret_ref;
32376 }
32377
32378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32379         if (!ptr_is_owned(_res)) return;
32380         void* _res_ptr = untag_ptr(_res);
32381         CHECK_ACCESS(_res_ptr);
32382         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
32383         FREE(untag_ptr(_res));
32384         COption_PaymentFailureReasonZ_free(_res_conv);
32385 }
32386
32387 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
32388         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32389         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
32390         int64_t ret_ref = tag_ptr(ret_copy, true);
32391         return ret_ref;
32392 }
32393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32394         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
32395         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
32396         return ret_conv;
32397 }
32398
32399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32400         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
32401         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32402         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
32403         int64_t ret_ref = tag_ptr(ret_copy, true);
32404         return ret_ref;
32405 }
32406
32407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32408         void* o_ptr = untag_ptr(o);
32409         CHECK_ACCESS(o_ptr);
32410         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
32411         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
32412         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32413         *ret_copy = COption_EventZ_some(o_conv);
32414         int64_t ret_ref = tag_ptr(ret_copy, true);
32415         return ret_ref;
32416 }
32417
32418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
32419         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32420         *ret_copy = COption_EventZ_none();
32421         int64_t ret_ref = tag_ptr(ret_copy, true);
32422         return ret_ref;
32423 }
32424
32425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32426         if (!ptr_is_owned(_res)) return;
32427         void* _res_ptr = untag_ptr(_res);
32428         CHECK_ACCESS(_res_ptr);
32429         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
32430         FREE(untag_ptr(_res));
32431         COption_EventZ_free(_res_conv);
32432 }
32433
32434 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
32435         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32436         *ret_copy = COption_EventZ_clone(arg);
32437         int64_t ret_ref = tag_ptr(ret_copy, true);
32438         return ret_ref;
32439 }
32440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32441         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
32442         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
32443         return ret_conv;
32444 }
32445
32446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32447         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
32448         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32449         *ret_copy = COption_EventZ_clone(orig_conv);
32450         int64_t ret_ref = tag_ptr(ret_copy, true);
32451         return ret_ref;
32452 }
32453
32454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32455         void* o_ptr = untag_ptr(o);
32456         CHECK_ACCESS(o_ptr);
32457         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
32458         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
32459         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32460         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
32461         return tag_ptr(ret_conv, true);
32462 }
32463
32464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32465         void* e_ptr = untag_ptr(e);
32466         CHECK_ACCESS(e_ptr);
32467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32469         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32470         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
32471         return tag_ptr(ret_conv, true);
32472 }
32473
32474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32475         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
32476         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
32477         return ret_conv;
32478 }
32479
32480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32481         if (!ptr_is_owned(_res)) return;
32482         void* _res_ptr = untag_ptr(_res);
32483         CHECK_ACCESS(_res_ptr);
32484         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
32485         FREE(untag_ptr(_res));
32486         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
32487 }
32488
32489 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
32490         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32491         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
32492         return tag_ptr(ret_conv, true);
32493 }
32494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32495         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
32496         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
32497         return ret_conv;
32498 }
32499
32500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32501         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
32502         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32503         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
32504         return tag_ptr(ret_conv, true);
32505 }
32506
32507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
32508         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
32509         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32510         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
32511         return tag_ptr(ret_conv, true);
32512 }
32513
32514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32515         void* e_ptr = untag_ptr(e);
32516         CHECK_ACCESS(e_ptr);
32517         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32518         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32519         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32520         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
32521         return tag_ptr(ret_conv, true);
32522 }
32523
32524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32525         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
32526         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
32527         return ret_conv;
32528 }
32529
32530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32531         if (!ptr_is_owned(_res)) return;
32532         void* _res_ptr = untag_ptr(_res);
32533         CHECK_ACCESS(_res_ptr);
32534         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
32535         FREE(untag_ptr(_res));
32536         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
32537 }
32538
32539 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
32540         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32541         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
32542         return tag_ptr(ret_conv, true);
32543 }
32544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32545         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
32546         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
32547         return ret_conv;
32548 }
32549
32550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32551         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
32552         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32553         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
32554         return tag_ptr(ret_conv, true);
32555 }
32556
32557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32558         LDKBolt11Invoice o_conv;
32559         o_conv.inner = untag_ptr(o);
32560         o_conv.is_owned = ptr_is_owned(o);
32561         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32562         o_conv = Bolt11Invoice_clone(&o_conv);
32563         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32564         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
32565         return tag_ptr(ret_conv, true);
32566 }
32567
32568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32569         void* e_ptr = untag_ptr(e);
32570         CHECK_ACCESS(e_ptr);
32571         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
32572         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
32573         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32574         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
32575         return tag_ptr(ret_conv, true);
32576 }
32577
32578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32579         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
32580         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
32581         return ret_conv;
32582 }
32583
32584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32585         if (!ptr_is_owned(_res)) return;
32586         void* _res_ptr = untag_ptr(_res);
32587         CHECK_ACCESS(_res_ptr);
32588         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
32589         FREE(untag_ptr(_res));
32590         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
32591 }
32592
32593 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
32594         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32595         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
32596         return tag_ptr(ret_conv, true);
32597 }
32598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32599         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
32600         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
32601         return ret_conv;
32602 }
32603
32604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32605         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
32606         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32607         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
32608         return tag_ptr(ret_conv, true);
32609 }
32610
32611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32612         LDKSignedRawBolt11Invoice o_conv;
32613         o_conv.inner = untag_ptr(o);
32614         o_conv.is_owned = ptr_is_owned(o);
32615         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32616         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
32617         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32618         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
32619         return tag_ptr(ret_conv, true);
32620 }
32621
32622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32623         void* e_ptr = untag_ptr(e);
32624         CHECK_ACCESS(e_ptr);
32625         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32626         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32627         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32628         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
32629         return tag_ptr(ret_conv, true);
32630 }
32631
32632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32633         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
32634         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
32635         return ret_conv;
32636 }
32637
32638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32639         if (!ptr_is_owned(_res)) return;
32640         void* _res_ptr = untag_ptr(_res);
32641         CHECK_ACCESS(_res_ptr);
32642         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
32643         FREE(untag_ptr(_res));
32644         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
32645 }
32646
32647 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
32648         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32649         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
32650         return tag_ptr(ret_conv, true);
32651 }
32652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32653         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
32654         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
32655         return ret_conv;
32656 }
32657
32658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32659         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
32660         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32661         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
32662         return tag_ptr(ret_conv, true);
32663 }
32664
32665 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
32666         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32667         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
32668         return tag_ptr(ret_conv, true);
32669 }
32670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32671         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
32672         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
32673         return ret_conv;
32674 }
32675
32676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32677         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
32678         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32679         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
32680         return tag_ptr(ret_conv, true);
32681 }
32682
32683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
32684         LDKRawBolt11Invoice a_conv;
32685         a_conv.inner = untag_ptr(a);
32686         a_conv.is_owned = ptr_is_owned(a);
32687         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32688         a_conv = RawBolt11Invoice_clone(&a_conv);
32689         LDKThirtyTwoBytes b_ref;
32690         CHECK((*env)->GetArrayLength(env, b) == 32);
32691         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
32692         LDKBolt11InvoiceSignature c_conv;
32693         c_conv.inner = untag_ptr(c);
32694         c_conv.is_owned = ptr_is_owned(c);
32695         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
32696         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
32697         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32698         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
32699         return tag_ptr(ret_conv, true);
32700 }
32701
32702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32703         if (!ptr_is_owned(_res)) return;
32704         void* _res_ptr = untag_ptr(_res);
32705         CHECK_ACCESS(_res_ptr);
32706         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
32707         FREE(untag_ptr(_res));
32708         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
32709 }
32710
32711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32712         LDKPayeePubKey o_conv;
32713         o_conv.inner = untag_ptr(o);
32714         o_conv.is_owned = ptr_is_owned(o);
32715         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32716         o_conv = PayeePubKey_clone(&o_conv);
32717         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32718         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
32719         return tag_ptr(ret_conv, true);
32720 }
32721
32722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32723         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
32724         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32725         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
32726         return tag_ptr(ret_conv, true);
32727 }
32728
32729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32730         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
32731         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
32732         return ret_conv;
32733 }
32734
32735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32736         if (!ptr_is_owned(_res)) return;
32737         void* _res_ptr = untag_ptr(_res);
32738         CHECK_ACCESS(_res_ptr);
32739         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
32740         FREE(untag_ptr(_res));
32741         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
32742 }
32743
32744 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
32745         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32746         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
32747         return tag_ptr(ret_conv, true);
32748 }
32749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32750         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
32751         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
32752         return ret_conv;
32753 }
32754
32755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32756         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
32757         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32758         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
32759         return tag_ptr(ret_conv, true);
32760 }
32761
32762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32763         LDKCVec_PrivateRouteZ _res_constr;
32764         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32765         if (_res_constr.datalen > 0)
32766                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
32767         else
32768                 _res_constr.data = NULL;
32769         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32770         for (size_t o = 0; o < _res_constr.datalen; o++) {
32771                 int64_t _res_conv_14 = _res_vals[o];
32772                 LDKPrivateRoute _res_conv_14_conv;
32773                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
32774                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
32775                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
32776                 _res_constr.data[o] = _res_conv_14_conv;
32777         }
32778         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32779         CVec_PrivateRouteZ_free(_res_constr);
32780 }
32781
32782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32783         LDKPositiveTimestamp o_conv;
32784         o_conv.inner = untag_ptr(o);
32785         o_conv.is_owned = ptr_is_owned(o);
32786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32787         o_conv = PositiveTimestamp_clone(&o_conv);
32788         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32789         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
32790         return tag_ptr(ret_conv, true);
32791 }
32792
32793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32794         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
32795         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32796         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
32797         return tag_ptr(ret_conv, true);
32798 }
32799
32800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32801         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
32802         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
32803         return ret_conv;
32804 }
32805
32806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32807         if (!ptr_is_owned(_res)) return;
32808         void* _res_ptr = untag_ptr(_res);
32809         CHECK_ACCESS(_res_ptr);
32810         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
32811         FREE(untag_ptr(_res));
32812         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
32813 }
32814
32815 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
32816         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32817         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
32818         return tag_ptr(ret_conv, true);
32819 }
32820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32821         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
32822         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
32823         return ret_conv;
32824 }
32825
32826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32827         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
32828         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32829         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
32830         return tag_ptr(ret_conv, true);
32831 }
32832
32833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
32834         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32835         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
32836         return tag_ptr(ret_conv, true);
32837 }
32838
32839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32840         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
32841         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32842         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
32843         return tag_ptr(ret_conv, true);
32844 }
32845
32846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32847         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
32848         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
32849         return ret_conv;
32850 }
32851
32852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32853         if (!ptr_is_owned(_res)) return;
32854         void* _res_ptr = untag_ptr(_res);
32855         CHECK_ACCESS(_res_ptr);
32856         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
32857         FREE(untag_ptr(_res));
32858         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
32859 }
32860
32861 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
32862         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32863         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
32864         return tag_ptr(ret_conv, true);
32865 }
32866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32867         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
32868         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
32869         return ret_conv;
32870 }
32871
32872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32873         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
32874         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32875         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
32876         return tag_ptr(ret_conv, true);
32877 }
32878
32879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32880         LDKBolt11Invoice o_conv;
32881         o_conv.inner = untag_ptr(o);
32882         o_conv.is_owned = ptr_is_owned(o);
32883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32884         o_conv = Bolt11Invoice_clone(&o_conv);
32885         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32886         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
32887         return tag_ptr(ret_conv, true);
32888 }
32889
32890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32891         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
32892         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32893         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
32894         return tag_ptr(ret_conv, true);
32895 }
32896
32897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32898         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
32899         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
32900         return ret_conv;
32901 }
32902
32903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32904         if (!ptr_is_owned(_res)) return;
32905         void* _res_ptr = untag_ptr(_res);
32906         CHECK_ACCESS(_res_ptr);
32907         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
32908         FREE(untag_ptr(_res));
32909         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
32910 }
32911
32912 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
32913         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32914         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
32915         return tag_ptr(ret_conv, true);
32916 }
32917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32918         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
32919         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
32920         return ret_conv;
32921 }
32922
32923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32924         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
32925         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32926         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
32927         return tag_ptr(ret_conv, true);
32928 }
32929
32930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32931         LDKDescription o_conv;
32932         o_conv.inner = untag_ptr(o);
32933         o_conv.is_owned = ptr_is_owned(o);
32934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32935         o_conv = Description_clone(&o_conv);
32936         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32937         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
32938         return tag_ptr(ret_conv, true);
32939 }
32940
32941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32942         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
32943         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32944         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
32945         return tag_ptr(ret_conv, true);
32946 }
32947
32948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32949         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
32950         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
32951         return ret_conv;
32952 }
32953
32954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32955         if (!ptr_is_owned(_res)) return;
32956         void* _res_ptr = untag_ptr(_res);
32957         CHECK_ACCESS(_res_ptr);
32958         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
32959         FREE(untag_ptr(_res));
32960         CResult_DescriptionCreationErrorZ_free(_res_conv);
32961 }
32962
32963 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
32964         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32965         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
32966         return tag_ptr(ret_conv, true);
32967 }
32968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32969         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
32970         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
32971         return ret_conv;
32972 }
32973
32974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32975         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
32976         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32977         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
32978         return tag_ptr(ret_conv, true);
32979 }
32980
32981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32982         LDKPrivateRoute o_conv;
32983         o_conv.inner = untag_ptr(o);
32984         o_conv.is_owned = ptr_is_owned(o);
32985         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32986         o_conv = PrivateRoute_clone(&o_conv);
32987         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32988         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
32989         return tag_ptr(ret_conv, true);
32990 }
32991
32992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32993         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
32994         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32995         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
32996         return tag_ptr(ret_conv, true);
32997 }
32998
32999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33000         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
33001         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
33002         return ret_conv;
33003 }
33004
33005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33006         if (!ptr_is_owned(_res)) return;
33007         void* _res_ptr = untag_ptr(_res);
33008         CHECK_ACCESS(_res_ptr);
33009         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
33010         FREE(untag_ptr(_res));
33011         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
33012 }
33013
33014 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
33015         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33016         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
33017         return tag_ptr(ret_conv, true);
33018 }
33019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33020         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
33021         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
33022         return ret_conv;
33023 }
33024
33025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33026         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
33027         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33028         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
33029         return tag_ptr(ret_conv, true);
33030 }
33031
33032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33033         LDKOutPoint o_conv;
33034         o_conv.inner = untag_ptr(o);
33035         o_conv.is_owned = ptr_is_owned(o);
33036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33037         o_conv = OutPoint_clone(&o_conv);
33038         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33039         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
33040         return tag_ptr(ret_conv, true);
33041 }
33042
33043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33044         void* e_ptr = untag_ptr(e);
33045         CHECK_ACCESS(e_ptr);
33046         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33047         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33048         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33049         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
33050         return tag_ptr(ret_conv, true);
33051 }
33052
33053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33054         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
33055         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
33056         return ret_conv;
33057 }
33058
33059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33060         if (!ptr_is_owned(_res)) return;
33061         void* _res_ptr = untag_ptr(_res);
33062         CHECK_ACCESS(_res_ptr);
33063         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
33064         FREE(untag_ptr(_res));
33065         CResult_OutPointDecodeErrorZ_free(_res_conv);
33066 }
33067
33068 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
33069         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33070         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
33071         return tag_ptr(ret_conv, true);
33072 }
33073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33074         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
33075         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
33076         return ret_conv;
33077 }
33078
33079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33080         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
33081         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33082         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
33083         return tag_ptr(ret_conv, true);
33084 }
33085
33086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33087         LDKBigSize o_conv;
33088         o_conv.inner = untag_ptr(o);
33089         o_conv.is_owned = ptr_is_owned(o);
33090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33091         o_conv = BigSize_clone(&o_conv);
33092         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33093         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
33094         return tag_ptr(ret_conv, true);
33095 }
33096
33097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33098         void* e_ptr = untag_ptr(e);
33099         CHECK_ACCESS(e_ptr);
33100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33102         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33103         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
33104         return tag_ptr(ret_conv, true);
33105 }
33106
33107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33108         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
33109         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
33110         return ret_conv;
33111 }
33112
33113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33114         if (!ptr_is_owned(_res)) return;
33115         void* _res_ptr = untag_ptr(_res);
33116         CHECK_ACCESS(_res_ptr);
33117         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
33118         FREE(untag_ptr(_res));
33119         CResult_BigSizeDecodeErrorZ_free(_res_conv);
33120 }
33121
33122 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
33123         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33124         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
33125         return tag_ptr(ret_conv, true);
33126 }
33127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33128         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
33129         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
33130         return ret_conv;
33131 }
33132
33133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33134         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
33135         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33136         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
33137         return tag_ptr(ret_conv, true);
33138 }
33139
33140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33141         LDKHostname o_conv;
33142         o_conv.inner = untag_ptr(o);
33143         o_conv.is_owned = ptr_is_owned(o);
33144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33145         o_conv = Hostname_clone(&o_conv);
33146         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33147         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
33148         return tag_ptr(ret_conv, true);
33149 }
33150
33151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33152         void* e_ptr = untag_ptr(e);
33153         CHECK_ACCESS(e_ptr);
33154         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33155         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33156         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33157         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
33158         return tag_ptr(ret_conv, true);
33159 }
33160
33161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33162         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
33163         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
33164         return ret_conv;
33165 }
33166
33167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33168         if (!ptr_is_owned(_res)) return;
33169         void* _res_ptr = untag_ptr(_res);
33170         CHECK_ACCESS(_res_ptr);
33171         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
33172         FREE(untag_ptr(_res));
33173         CResult_HostnameDecodeErrorZ_free(_res_conv);
33174 }
33175
33176 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
33177         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33178         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
33179         return tag_ptr(ret_conv, true);
33180 }
33181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33182         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
33183         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
33184         return ret_conv;
33185 }
33186
33187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33188         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
33189         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33190         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
33191         return tag_ptr(ret_conv, true);
33192 }
33193
33194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33195         LDKTransactionU16LenLimited o_conv;
33196         o_conv.inner = untag_ptr(o);
33197         o_conv.is_owned = ptr_is_owned(o);
33198         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33199         o_conv = TransactionU16LenLimited_clone(&o_conv);
33200         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33201         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
33202         return tag_ptr(ret_conv, true);
33203 }
33204
33205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
33206         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33207         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
33208         return tag_ptr(ret_conv, true);
33209 }
33210
33211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33212         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
33213         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
33214         return ret_conv;
33215 }
33216
33217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33218         if (!ptr_is_owned(_res)) return;
33219         void* _res_ptr = untag_ptr(_res);
33220         CHECK_ACCESS(_res_ptr);
33221         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
33222         FREE(untag_ptr(_res));
33223         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
33224 }
33225
33226 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
33227         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33228         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
33229         return tag_ptr(ret_conv, true);
33230 }
33231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33232         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
33233         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
33234         return ret_conv;
33235 }
33236
33237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33238         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
33239         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33240         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
33241         return tag_ptr(ret_conv, true);
33242 }
33243
33244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33245         LDKTransactionU16LenLimited o_conv;
33246         o_conv.inner = untag_ptr(o);
33247         o_conv.is_owned = ptr_is_owned(o);
33248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33249         o_conv = TransactionU16LenLimited_clone(&o_conv);
33250         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33251         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
33252         return tag_ptr(ret_conv, true);
33253 }
33254
33255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33256         void* e_ptr = untag_ptr(e);
33257         CHECK_ACCESS(e_ptr);
33258         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33259         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33260         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33261         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
33262         return tag_ptr(ret_conv, true);
33263 }
33264
33265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33266         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
33267         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
33268         return ret_conv;
33269 }
33270
33271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33272         if (!ptr_is_owned(_res)) return;
33273         void* _res_ptr = untag_ptr(_res);
33274         CHECK_ACCESS(_res_ptr);
33275         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
33276         FREE(untag_ptr(_res));
33277         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
33278 }
33279
33280 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
33281         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33282         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
33283         return tag_ptr(ret_conv, true);
33284 }
33285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33286         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
33287         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
33288         return ret_conv;
33289 }
33290
33291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33292         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
33293         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33294         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
33295         return tag_ptr(ret_conv, true);
33296 }
33297
33298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33299         LDKUntrustedString o_conv;
33300         o_conv.inner = untag_ptr(o);
33301         o_conv.is_owned = ptr_is_owned(o);
33302         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33303         o_conv = UntrustedString_clone(&o_conv);
33304         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33305         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
33306         return tag_ptr(ret_conv, true);
33307 }
33308
33309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33310         void* e_ptr = untag_ptr(e);
33311         CHECK_ACCESS(e_ptr);
33312         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33313         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33314         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33315         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
33316         return tag_ptr(ret_conv, true);
33317 }
33318
33319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33320         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
33321         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
33322         return ret_conv;
33323 }
33324
33325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33326         if (!ptr_is_owned(_res)) return;
33327         void* _res_ptr = untag_ptr(_res);
33328         CHECK_ACCESS(_res_ptr);
33329         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
33330         FREE(untag_ptr(_res));
33331         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
33332 }
33333
33334 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
33335         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33336         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
33337         return tag_ptr(ret_conv, true);
33338 }
33339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33340         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
33341         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
33342         return ret_conv;
33343 }
33344
33345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33346         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
33347         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33348         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
33349         return tag_ptr(ret_conv, true);
33350 }
33351
33352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33353         LDKReceiveTlvs o_conv;
33354         o_conv.inner = untag_ptr(o);
33355         o_conv.is_owned = ptr_is_owned(o);
33356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33357         o_conv = ReceiveTlvs_clone(&o_conv);
33358         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33359         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_ok(o_conv);
33360         return tag_ptr(ret_conv, true);
33361 }
33362
33363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33364         void* e_ptr = untag_ptr(e);
33365         CHECK_ACCESS(e_ptr);
33366         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33367         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33368         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33369         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_err(e_conv);
33370         return tag_ptr(ret_conv, true);
33371 }
33372
33373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33374         LDKCResult_ReceiveTlvsDecodeErrorZ* o_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(o);
33375         jboolean ret_conv = CResult_ReceiveTlvsDecodeErrorZ_is_ok(o_conv);
33376         return ret_conv;
33377 }
33378
33379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33380         if (!ptr_is_owned(_res)) return;
33381         void* _res_ptr = untag_ptr(_res);
33382         CHECK_ACCESS(_res_ptr);
33383         LDKCResult_ReceiveTlvsDecodeErrorZ _res_conv = *(LDKCResult_ReceiveTlvsDecodeErrorZ*)(_res_ptr);
33384         FREE(untag_ptr(_res));
33385         CResult_ReceiveTlvsDecodeErrorZ_free(_res_conv);
33386 }
33387
33388 static inline uint64_t CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR arg) {
33389         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33390         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(arg);
33391         return tag_ptr(ret_conv, true);
33392 }
33393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33394         LDKCResult_ReceiveTlvsDecodeErrorZ* arg_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(arg);
33395         int64_t ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(arg_conv);
33396         return ret_conv;
33397 }
33398
33399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33400         LDKCResult_ReceiveTlvsDecodeErrorZ* orig_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(orig);
33401         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33402         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(orig_conv);
33403         return tag_ptr(ret_conv, true);
33404 }
33405
33406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33407         LDKPaymentRelay o_conv;
33408         o_conv.inner = untag_ptr(o);
33409         o_conv.is_owned = ptr_is_owned(o);
33410         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33411         o_conv = PaymentRelay_clone(&o_conv);
33412         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33413         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
33414         return tag_ptr(ret_conv, true);
33415 }
33416
33417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33418         void* e_ptr = untag_ptr(e);
33419         CHECK_ACCESS(e_ptr);
33420         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33421         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33422         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33423         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
33424         return tag_ptr(ret_conv, true);
33425 }
33426
33427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33428         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
33429         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
33430         return ret_conv;
33431 }
33432
33433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33434         if (!ptr_is_owned(_res)) return;
33435         void* _res_ptr = untag_ptr(_res);
33436         CHECK_ACCESS(_res_ptr);
33437         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
33438         FREE(untag_ptr(_res));
33439         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
33440 }
33441
33442 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
33443         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33444         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
33445         return tag_ptr(ret_conv, true);
33446 }
33447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33448         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
33449         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
33450         return ret_conv;
33451 }
33452
33453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33454         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
33455         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33456         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
33457         return tag_ptr(ret_conv, true);
33458 }
33459
33460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33461         LDKPaymentConstraints o_conv;
33462         o_conv.inner = untag_ptr(o);
33463         o_conv.is_owned = ptr_is_owned(o);
33464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33465         o_conv = PaymentConstraints_clone(&o_conv);
33466         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33467         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
33468         return tag_ptr(ret_conv, true);
33469 }
33470
33471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33472         void* e_ptr = untag_ptr(e);
33473         CHECK_ACCESS(e_ptr);
33474         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33475         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33476         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33477         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
33478         return tag_ptr(ret_conv, true);
33479 }
33480
33481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33482         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
33483         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
33484         return ret_conv;
33485 }
33486
33487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33488         if (!ptr_is_owned(_res)) return;
33489         void* _res_ptr = untag_ptr(_res);
33490         CHECK_ACCESS(_res_ptr);
33491         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
33492         FREE(untag_ptr(_res));
33493         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
33494 }
33495
33496 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
33497         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33498         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
33499         return tag_ptr(ret_conv, true);
33500 }
33501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33502         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
33503         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
33504         return ret_conv;
33505 }
33506
33507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33508         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
33509         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33510         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
33511         return tag_ptr(ret_conv, true);
33512 }
33513
33514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
33515         LDKThirtyTwoBytes o_ref;
33516         CHECK((*env)->GetArrayLength(env, o) == 32);
33517         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
33518         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
33519         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_ok(o_ref);
33520         return tag_ptr(ret_conv, true);
33521 }
33522
33523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33524         void* e_ptr = untag_ptr(e);
33525         CHECK_ACCESS(e_ptr);
33526         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
33527         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
33528         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
33529         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_err(e_conv);
33530         return tag_ptr(ret_conv, true);
33531 }
33532
33533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33534         LDKCResult_ThirtyTwoBytesPaymentErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(o);
33535         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o_conv);
33536         return ret_conv;
33537 }
33538
33539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33540         if (!ptr_is_owned(_res)) return;
33541         void* _res_ptr = untag_ptr(_res);
33542         CHECK_ACCESS(_res_ptr);
33543         LDKCResult_ThirtyTwoBytesPaymentErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentErrorZ*)(_res_ptr);
33544         FREE(untag_ptr(_res));
33545         CResult_ThirtyTwoBytesPaymentErrorZ_free(_res_conv);
33546 }
33547
33548 static inline uint64_t CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR arg) {
33549         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
33550         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(arg);
33551         return tag_ptr(ret_conv, true);
33552 }
33553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33554         LDKCResult_ThirtyTwoBytesPaymentErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(arg);
33555         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(arg_conv);
33556         return ret_conv;
33557 }
33558
33559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33560         LDKCResult_ThirtyTwoBytesPaymentErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(orig);
33561         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
33562         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig_conv);
33563         return tag_ptr(ret_conv, true);
33564 }
33565
33566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1ok(JNIEnv *env, jclass clz) {
33567         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
33568         *ret_conv = CResult_NonePaymentErrorZ_ok();
33569         return tag_ptr(ret_conv, true);
33570 }
33571
33572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33573         void* e_ptr = untag_ptr(e);
33574         CHECK_ACCESS(e_ptr);
33575         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
33576         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
33577         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
33578         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
33579         return tag_ptr(ret_conv, true);
33580 }
33581
33582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33583         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
33584         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
33585         return ret_conv;
33586 }
33587
33588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33589         if (!ptr_is_owned(_res)) return;
33590         void* _res_ptr = untag_ptr(_res);
33591         CHECK_ACCESS(_res_ptr);
33592         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
33593         FREE(untag_ptr(_res));
33594         CResult_NonePaymentErrorZ_free(_res_conv);
33595 }
33596
33597 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
33598         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
33599         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
33600         return tag_ptr(ret_conv, true);
33601 }
33602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33603         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
33604         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
33605         return ret_conv;
33606 }
33607
33608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33609         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
33610         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
33611         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
33612         return tag_ptr(ret_conv, true);
33613 }
33614
33615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
33616         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
33617         o_constr.datalen = (*env)->GetArrayLength(env, o);
33618         if (o_constr.datalen > 0)
33619                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
33620         else
33621                 o_constr.data = NULL;
33622         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
33623         for (size_t o = 0; o < o_constr.datalen; o++) {
33624                 int64_t o_conv_40 = o_vals[o];
33625                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
33626                 CHECK_ACCESS(o_conv_40_ptr);
33627                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
33628                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
33629                 o_constr.data[o] = o_conv_40_conv;
33630         }
33631         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
33632         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
33633         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o_constr);
33634         return tag_ptr(ret_conv, true);
33635 }
33636
33637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33638         void* e_ptr = untag_ptr(e);
33639         CHECK_ACCESS(e_ptr);
33640         LDKProbingError e_conv = *(LDKProbingError*)(e_ptr);
33641         e_conv = ProbingError_clone((LDKProbingError*)untag_ptr(e));
33642         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
33643         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e_conv);
33644         return tag_ptr(ret_conv, true);
33645 }
33646
33647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33648         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(o);
33649         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o_conv);
33650         return ret_conv;
33651 }
33652
33653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33654         if (!ptr_is_owned(_res)) return;
33655         void* _res_ptr = untag_ptr(_res);
33656         CHECK_ACCESS(_res_ptr);
33657         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)(_res_ptr);
33658         FREE(untag_ptr(_res));
33659         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res_conv);
33660 }
33661
33662 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR arg) {
33663         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
33664         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(arg);
33665         return tag_ptr(ret_conv, true);
33666 }
33667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33668         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(arg);
33669         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(arg_conv);
33670         return ret_conv;
33671 }
33672
33673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33674         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(orig);
33675         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
33676         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig_conv);
33677         return tag_ptr(ret_conv, true);
33678 }
33679
33680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
33681         LDKStr o_conv = java_to_owned_str(env, o);
33682         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33683         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
33684         return tag_ptr(ret_conv, true);
33685 }
33686
33687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33688         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
33689         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33690         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
33691         return tag_ptr(ret_conv, true);
33692 }
33693
33694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33695         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
33696         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
33697         return ret_conv;
33698 }
33699
33700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33701         if (!ptr_is_owned(_res)) return;
33702         void* _res_ptr = untag_ptr(_res);
33703         CHECK_ACCESS(_res_ptr);
33704         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
33705         FREE(untag_ptr(_res));
33706         CResult_StrSecp256k1ErrorZ_free(_res_conv);
33707 }
33708
33709 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
33710         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33711         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
33712         return tag_ptr(ret_conv, true);
33713 }
33714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33715         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
33716         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
33717         return ret_conv;
33718 }
33719
33720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33721         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
33722         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33723         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
33724         return tag_ptr(ret_conv, true);
33725 }
33726
33727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33728         void* o_ptr = untag_ptr(o);
33729         CHECK_ACCESS(o_ptr);
33730         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
33731         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
33732         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33733         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
33734         return tag_ptr(ret_conv, true);
33735 }
33736
33737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33738         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
33739         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33740         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
33741         return tag_ptr(ret_conv, true);
33742 }
33743
33744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33745         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
33746         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
33747         return ret_conv;
33748 }
33749
33750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33751         if (!ptr_is_owned(_res)) return;
33752         void* _res_ptr = untag_ptr(_res);
33753         CHECK_ACCESS(_res_ptr);
33754         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
33755         FREE(untag_ptr(_res));
33756         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
33757 }
33758
33759 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
33760         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33761         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
33762         return tag_ptr(ret_conv, true);
33763 }
33764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33765         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
33766         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
33767         return ret_conv;
33768 }
33769
33770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33771         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
33772         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33773         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
33774         return tag_ptr(ret_conv, true);
33775 }
33776
33777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33778         LDKOnionMessagePath o_conv;
33779         o_conv.inner = untag_ptr(o);
33780         o_conv.is_owned = ptr_is_owned(o);
33781         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33782         o_conv = OnionMessagePath_clone(&o_conv);
33783         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
33784         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
33785         return tag_ptr(ret_conv, true);
33786 }
33787
33788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
33789         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
33790         *ret_conv = CResult_OnionMessagePathNoneZ_err();
33791         return tag_ptr(ret_conv, true);
33792 }
33793
33794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33795         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
33796         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
33797         return ret_conv;
33798 }
33799
33800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33801         if (!ptr_is_owned(_res)) return;
33802         void* _res_ptr = untag_ptr(_res);
33803         CHECK_ACCESS(_res_ptr);
33804         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
33805         FREE(untag_ptr(_res));
33806         CResult_OnionMessagePathNoneZ_free(_res_conv);
33807 }
33808
33809 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
33810         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
33811         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
33812         return tag_ptr(ret_conv, true);
33813 }
33814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33815         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
33816         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
33817         return ret_conv;
33818 }
33819
33820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33821         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
33822         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
33823         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
33824         return tag_ptr(ret_conv, true);
33825 }
33826
33827 static inline uint64_t C2Tuple_PublicKeyOnionMessageZ_clone_ptr(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR arg) {
33828         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
33829         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(arg);
33830         return tag_ptr(ret_conv, true);
33831 }
33832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33833         LDKC2Tuple_PublicKeyOnionMessageZ* arg_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(arg);
33834         int64_t ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone_ptr(arg_conv);
33835         return ret_conv;
33836 }
33837
33838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33839         LDKC2Tuple_PublicKeyOnionMessageZ* orig_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(orig);
33840         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
33841         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(orig_conv);
33842         return tag_ptr(ret_conv, true);
33843 }
33844
33845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
33846         LDKPublicKey a_ref;
33847         CHECK((*env)->GetArrayLength(env, a) == 33);
33848         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
33849         LDKOnionMessage b_conv;
33850         b_conv.inner = untag_ptr(b);
33851         b_conv.is_owned = ptr_is_owned(b);
33852         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33853         b_conv = OnionMessage_clone(&b_conv);
33854         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
33855         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_new(a_ref, b_conv);
33856         return tag_ptr(ret_conv, true);
33857 }
33858
33859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33860         if (!ptr_is_owned(_res)) return;
33861         void* _res_ptr = untag_ptr(_res);
33862         CHECK_ACCESS(_res_ptr);
33863         LDKC2Tuple_PublicKeyOnionMessageZ _res_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(_res_ptr);
33864         FREE(untag_ptr(_res));
33865         C2Tuple_PublicKeyOnionMessageZ_free(_res_conv);
33866 }
33867
33868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33869         void* o_ptr = untag_ptr(o);
33870         CHECK_ACCESS(o_ptr);
33871         LDKC2Tuple_PublicKeyOnionMessageZ o_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(o_ptr);
33872         o_conv = C2Tuple_PublicKeyOnionMessageZ_clone((LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(o));
33873         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
33874         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o_conv);
33875         return tag_ptr(ret_conv, true);
33876 }
33877
33878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33879         void* e_ptr = untag_ptr(e);
33880         CHECK_ACCESS(e_ptr);
33881         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
33882         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
33883         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
33884         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e_conv);
33885         return tag_ptr(ret_conv, true);
33886 }
33887
33888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33889         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* o_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(o);
33890         jboolean ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o_conv);
33891         return ret_conv;
33892 }
33893
33894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33895         if (!ptr_is_owned(_res)) return;
33896         void* _res_ptr = untag_ptr(_res);
33897         CHECK_ACCESS(_res_ptr);
33898         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res_conv = *(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)(_res_ptr);
33899         FREE(untag_ptr(_res));
33900         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res_conv);
33901 }
33902
33903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) {
33904         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
33905         *ret_conv = CResult_NoneSendErrorZ_ok();
33906         return tag_ptr(ret_conv, true);
33907 }
33908
33909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33910         void* e_ptr = untag_ptr(e);
33911         CHECK_ACCESS(e_ptr);
33912         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
33913         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
33914         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
33915         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
33916         return tag_ptr(ret_conv, true);
33917 }
33918
33919 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33920         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
33921         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
33922         return ret_conv;
33923 }
33924
33925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33926         if (!ptr_is_owned(_res)) return;
33927         void* _res_ptr = untag_ptr(_res);
33928         CHECK_ACCESS(_res_ptr);
33929         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
33930         FREE(untag_ptr(_res));
33931         CResult_NoneSendErrorZ_free(_res_conv);
33932 }
33933
33934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33935         LDKBlindedPath o_conv;
33936         o_conv.inner = untag_ptr(o);
33937         o_conv.is_owned = ptr_is_owned(o);
33938         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33939         o_conv = BlindedPath_clone(&o_conv);
33940         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33941         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
33942         return tag_ptr(ret_conv, true);
33943 }
33944
33945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
33946         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33947         *ret_conv = CResult_BlindedPathNoneZ_err();
33948         return tag_ptr(ret_conv, true);
33949 }
33950
33951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33952         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
33953         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
33954         return ret_conv;
33955 }
33956
33957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33958         if (!ptr_is_owned(_res)) return;
33959         void* _res_ptr = untag_ptr(_res);
33960         CHECK_ACCESS(_res_ptr);
33961         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
33962         FREE(untag_ptr(_res));
33963         CResult_BlindedPathNoneZ_free(_res_conv);
33964 }
33965
33966 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
33967         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33968         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
33969         return tag_ptr(ret_conv, true);
33970 }
33971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33972         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
33973         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
33974         return ret_conv;
33975 }
33976
33977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33978         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
33979         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
33980         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
33981         return tag_ptr(ret_conv, true);
33982 }
33983
33984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33985         void* o_ptr = untag_ptr(o);
33986         CHECK_ACCESS(o_ptr);
33987         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
33988         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
33989         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33990         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
33991         return tag_ptr(ret_conv, true);
33992 }
33993
33994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
33995         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
33996         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
33997         return tag_ptr(ret_conv, true);
33998 }
33999
34000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34001         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
34002         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
34003         return ret_conv;
34004 }
34005
34006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34007         if (!ptr_is_owned(_res)) return;
34008         void* _res_ptr = untag_ptr(_res);
34009         CHECK_ACCESS(_res_ptr);
34010         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
34011         FREE(untag_ptr(_res));
34012         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
34013 }
34014
34015 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
34016         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34017         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
34018         return tag_ptr(ret_conv, true);
34019 }
34020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34021         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
34022         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
34023         return ret_conv;
34024 }
34025
34026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34027         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
34028         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34029         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
34030         return tag_ptr(ret_conv, true);
34031 }
34032
34033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34034         LDKBlindedPath o_conv;
34035         o_conv.inner = untag_ptr(o);
34036         o_conv.is_owned = ptr_is_owned(o);
34037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34038         o_conv = BlindedPath_clone(&o_conv);
34039         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34040         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
34041         return tag_ptr(ret_conv, true);
34042 }
34043
34044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34045         void* e_ptr = untag_ptr(e);
34046         CHECK_ACCESS(e_ptr);
34047         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34048         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34049         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34050         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
34051         return tag_ptr(ret_conv, true);
34052 }
34053
34054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34055         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
34056         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
34057         return ret_conv;
34058 }
34059
34060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34061         if (!ptr_is_owned(_res)) return;
34062         void* _res_ptr = untag_ptr(_res);
34063         CHECK_ACCESS(_res_ptr);
34064         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
34065         FREE(untag_ptr(_res));
34066         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
34067 }
34068
34069 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
34070         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34071         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
34072         return tag_ptr(ret_conv, true);
34073 }
34074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34075         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
34076         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
34077         return ret_conv;
34078 }
34079
34080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34081         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
34082         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34083         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
34084         return tag_ptr(ret_conv, true);
34085 }
34086
34087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34088         LDKBlindedHop o_conv;
34089         o_conv.inner = untag_ptr(o);
34090         o_conv.is_owned = ptr_is_owned(o);
34091         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34092         o_conv = BlindedHop_clone(&o_conv);
34093         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34094         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
34095         return tag_ptr(ret_conv, true);
34096 }
34097
34098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34099         void* e_ptr = untag_ptr(e);
34100         CHECK_ACCESS(e_ptr);
34101         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34102         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34103         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34104         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
34105         return tag_ptr(ret_conv, true);
34106 }
34107
34108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34109         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
34110         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
34111         return ret_conv;
34112 }
34113
34114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34115         if (!ptr_is_owned(_res)) return;
34116         void* _res_ptr = untag_ptr(_res);
34117         CHECK_ACCESS(_res_ptr);
34118         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
34119         FREE(untag_ptr(_res));
34120         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
34121 }
34122
34123 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
34124         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34125         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
34126         return tag_ptr(ret_conv, true);
34127 }
34128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34129         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
34130         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
34131         return ret_conv;
34132 }
34133
34134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34135         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
34136         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34137         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
34138         return tag_ptr(ret_conv, true);
34139 }
34140
34141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34142         LDKInvoiceError o_conv;
34143         o_conv.inner = untag_ptr(o);
34144         o_conv.is_owned = ptr_is_owned(o);
34145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34146         o_conv = InvoiceError_clone(&o_conv);
34147         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34148         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
34149         return tag_ptr(ret_conv, true);
34150 }
34151
34152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34153         void* e_ptr = untag_ptr(e);
34154         CHECK_ACCESS(e_ptr);
34155         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34156         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34157         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34158         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
34159         return tag_ptr(ret_conv, true);
34160 }
34161
34162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34163         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
34164         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
34165         return ret_conv;
34166 }
34167
34168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34169         if (!ptr_is_owned(_res)) return;
34170         void* _res_ptr = untag_ptr(_res);
34171         CHECK_ACCESS(_res_ptr);
34172         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
34173         FREE(untag_ptr(_res));
34174         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
34175 }
34176
34177 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
34178         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34179         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
34180         return tag_ptr(ret_conv, true);
34181 }
34182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34183         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
34184         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
34185         return ret_conv;
34186 }
34187
34188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34189         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
34190         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34191         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
34192         return tag_ptr(ret_conv, true);
34193 }
34194
34195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34196         void* o_ptr = untag_ptr(o);
34197         CHECK_ACCESS(o_ptr);
34198         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
34199         if (o_conv.free == LDKFilter_JCalls_free) {
34200                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34201                 LDKFilter_JCalls_cloned(&o_conv);
34202         }
34203         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34204         *ret_copy = COption_FilterZ_some(o_conv);
34205         int64_t ret_ref = tag_ptr(ret_copy, true);
34206         return ret_ref;
34207 }
34208
34209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
34210         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34211         *ret_copy = COption_FilterZ_none();
34212         int64_t ret_ref = tag_ptr(ret_copy, true);
34213         return ret_ref;
34214 }
34215
34216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34217         if (!ptr_is_owned(_res)) return;
34218         void* _res_ptr = untag_ptr(_res);
34219         CHECK_ACCESS(_res_ptr);
34220         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
34221         FREE(untag_ptr(_res));
34222         COption_FilterZ_free(_res_conv);
34223 }
34224
34225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34226         LDKLockedChannelMonitor o_conv;
34227         o_conv.inner = untag_ptr(o);
34228         o_conv.is_owned = ptr_is_owned(o);
34229         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34230         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
34231         
34232         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34233         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
34234         return tag_ptr(ret_conv, true);
34235 }
34236
34237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
34238         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34239         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
34240         return tag_ptr(ret_conv, true);
34241 }
34242
34243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34244         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
34245         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
34246         return ret_conv;
34247 }
34248
34249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34250         if (!ptr_is_owned(_res)) return;
34251         void* _res_ptr = untag_ptr(_res);
34252         CHECK_ACCESS(_res_ptr);
34253         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
34254         FREE(untag_ptr(_res));
34255         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
34256 }
34257
34258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34259         LDKCVec_OutPointZ _res_constr;
34260         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34261         if (_res_constr.datalen > 0)
34262                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
34263         else
34264                 _res_constr.data = NULL;
34265         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34266         for (size_t k = 0; k < _res_constr.datalen; k++) {
34267                 int64_t _res_conv_10 = _res_vals[k];
34268                 LDKOutPoint _res_conv_10_conv;
34269                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
34270                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
34271                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
34272                 _res_constr.data[k] = _res_conv_10_conv;
34273         }
34274         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34275         CVec_OutPointZ_free(_res_constr);
34276 }
34277
34278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34279         LDKCVec_MonitorUpdateIdZ _res_constr;
34280         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34281         if (_res_constr.datalen > 0)
34282                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34283         else
34284                 _res_constr.data = NULL;
34285         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34286         for (size_t r = 0; r < _res_constr.datalen; r++) {
34287                 int64_t _res_conv_17 = _res_vals[r];
34288                 LDKMonitorUpdateId _res_conv_17_conv;
34289                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
34290                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
34291                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
34292                 _res_constr.data[r] = _res_conv_17_conv;
34293         }
34294         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34295         CVec_MonitorUpdateIdZ_free(_res_constr);
34296 }
34297
34298 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
34299         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34300         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
34301         return tag_ptr(ret_conv, true);
34302 }
34303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34304         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
34305         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
34306         return ret_conv;
34307 }
34308
34309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34310         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
34311         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34312         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
34313         return tag_ptr(ret_conv, true);
34314 }
34315
34316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
34317         LDKOutPoint a_conv;
34318         a_conv.inner = untag_ptr(a);
34319         a_conv.is_owned = ptr_is_owned(a);
34320         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34321         a_conv = OutPoint_clone(&a_conv);
34322         LDKCVec_MonitorUpdateIdZ b_constr;
34323         b_constr.datalen = (*env)->GetArrayLength(env, b);
34324         if (b_constr.datalen > 0)
34325                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34326         else
34327                 b_constr.data = NULL;
34328         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
34329         for (size_t r = 0; r < b_constr.datalen; r++) {
34330                 int64_t b_conv_17 = b_vals[r];
34331                 LDKMonitorUpdateId b_conv_17_conv;
34332                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
34333                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
34334                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
34335                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
34336                 b_constr.data[r] = b_conv_17_conv;
34337         }
34338         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
34339         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34340         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
34341         return tag_ptr(ret_conv, true);
34342 }
34343
34344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34345         if (!ptr_is_owned(_res)) return;
34346         void* _res_ptr = untag_ptr(_res);
34347         CHECK_ACCESS(_res_ptr);
34348         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
34349         FREE(untag_ptr(_res));
34350         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
34351 }
34352
34353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34354         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
34355         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34356         if (_res_constr.datalen > 0)
34357                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
34358         else
34359                 _res_constr.data = NULL;
34360         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34361         for (size_t p = 0; p < _res_constr.datalen; p++) {
34362                 int64_t _res_conv_41 = _res_vals[p];
34363                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
34364                 CHECK_ACCESS(_res_conv_41_ptr);
34365                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
34366                 FREE(untag_ptr(_res_conv_41));
34367                 _res_constr.data[p] = _res_conv_41_conv;
34368         }
34369         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34370         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
34371 }
34372
34373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34374         if (!ptr_is_owned(this_ptr)) return;
34375         void* this_ptr_ptr = untag_ptr(this_ptr);
34376         CHECK_ACCESS(this_ptr_ptr);
34377         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
34378         FREE(untag_ptr(this_ptr));
34379         APIError_free(this_ptr_conv);
34380 }
34381
34382 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
34383         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34384         *ret_copy = APIError_clone(arg);
34385         int64_t ret_ref = tag_ptr(ret_copy, true);
34386         return ret_ref;
34387 }
34388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34389         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
34390         int64_t ret_conv = APIError_clone_ptr(arg_conv);
34391         return ret_conv;
34392 }
34393
34394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34395         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
34396         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34397         *ret_copy = APIError_clone(orig_conv);
34398         int64_t ret_ref = tag_ptr(ret_copy, true);
34399         return ret_ref;
34400 }
34401
34402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
34403         LDKStr err_conv = java_to_owned_str(env, err);
34404         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34405         *ret_copy = APIError_apimisuse_error(err_conv);
34406         int64_t ret_ref = tag_ptr(ret_copy, true);
34407         return ret_ref;
34408 }
34409
34410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
34411         LDKStr err_conv = java_to_owned_str(env, err);
34412         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34413         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
34414         int64_t ret_ref = tag_ptr(ret_copy, true);
34415         return ret_ref;
34416 }
34417
34418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
34419         LDKStr err_conv = java_to_owned_str(env, err);
34420         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34421         *ret_copy = APIError_invalid_route(err_conv);
34422         int64_t ret_ref = tag_ptr(ret_copy, true);
34423         return ret_ref;
34424 }
34425
34426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
34427         LDKStr err_conv = java_to_owned_str(env, err);
34428         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34429         *ret_copy = APIError_channel_unavailable(err_conv);
34430         int64_t ret_ref = tag_ptr(ret_copy, true);
34431         return ret_ref;
34432 }
34433
34434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
34435         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34436         *ret_copy = APIError_monitor_update_in_progress();
34437         int64_t ret_ref = tag_ptr(ret_copy, true);
34438         return ret_ref;
34439 }
34440
34441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
34442         LDKShutdownScript script_conv;
34443         script_conv.inner = untag_ptr(script);
34444         script_conv.is_owned = ptr_is_owned(script);
34445         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
34446         script_conv = ShutdownScript_clone(&script_conv);
34447         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34448         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
34449         int64_t ret_ref = tag_ptr(ret_copy, true);
34450         return ret_ref;
34451 }
34452
34453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34454         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
34455         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
34456         jboolean ret_conv = APIError_eq(a_conv, b_conv);
34457         return ret_conv;
34458 }
34459
34460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
34461         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
34462         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
34463         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34464         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34465         CVec_u8Z_free(ret_var);
34466         return ret_arr;
34467 }
34468
34469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34470         LDKu8slice ser_ref;
34471         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34472         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34473         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
34474         *ret_conv = APIError_read(ser_ref);
34475         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34476         return tag_ptr(ret_conv, true);
34477 }
34478
34479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34480         LDKBigSize this_obj_conv;
34481         this_obj_conv.inner = untag_ptr(this_obj);
34482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34484         BigSize_free(this_obj_conv);
34485 }
34486
34487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
34488         LDKBigSize this_ptr_conv;
34489         this_ptr_conv.inner = untag_ptr(this_ptr);
34490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34492         this_ptr_conv.is_owned = false;
34493         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
34494         return ret_conv;
34495 }
34496
34497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34498         LDKBigSize this_ptr_conv;
34499         this_ptr_conv.inner = untag_ptr(this_ptr);
34500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34502         this_ptr_conv.is_owned = false;
34503         BigSize_set_a(&this_ptr_conv, val);
34504 }
34505
34506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
34507         LDKBigSize ret_var = BigSize_new(a_arg);
34508         int64_t ret_ref = 0;
34509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34511         return ret_ref;
34512 }
34513
34514 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
34515         LDKBigSize ret_var = BigSize_clone(arg);
34516         int64_t ret_ref = 0;
34517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34519         return ret_ref;
34520 }
34521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34522         LDKBigSize arg_conv;
34523         arg_conv.inner = untag_ptr(arg);
34524         arg_conv.is_owned = ptr_is_owned(arg);
34525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34526         arg_conv.is_owned = false;
34527         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
34528         return ret_conv;
34529 }
34530
34531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34532         LDKBigSize orig_conv;
34533         orig_conv.inner = untag_ptr(orig);
34534         orig_conv.is_owned = ptr_is_owned(orig);
34535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34536         orig_conv.is_owned = false;
34537         LDKBigSize ret_var = BigSize_clone(&orig_conv);
34538         int64_t ret_ref = 0;
34539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34541         return ret_ref;
34542 }
34543
34544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
34545         LDKBigSize o_conv;
34546         o_conv.inner = untag_ptr(o);
34547         o_conv.is_owned = ptr_is_owned(o);
34548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34549         o_conv.is_owned = false;
34550         int64_t ret_conv = BigSize_hash(&o_conv);
34551         return ret_conv;
34552 }
34553
34554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34555         LDKBigSize a_conv;
34556         a_conv.inner = untag_ptr(a);
34557         a_conv.is_owned = ptr_is_owned(a);
34558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34559         a_conv.is_owned = false;
34560         LDKBigSize b_conv;
34561         b_conv.inner = untag_ptr(b);
34562         b_conv.is_owned = ptr_is_owned(b);
34563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34564         b_conv.is_owned = false;
34565         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
34566         return ret_conv;
34567 }
34568
34569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
34570         LDKBigSize obj_conv;
34571         obj_conv.inner = untag_ptr(obj);
34572         obj_conv.is_owned = ptr_is_owned(obj);
34573         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34574         obj_conv.is_owned = false;
34575         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
34576         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34577         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34578         CVec_u8Z_free(ret_var);
34579         return ret_arr;
34580 }
34581
34582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34583         LDKu8slice ser_ref;
34584         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34585         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34586         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
34587         *ret_conv = BigSize_read(ser_ref);
34588         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34589         return tag_ptr(ret_conv, true);
34590 }
34591
34592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34593         LDKHostname this_obj_conv;
34594         this_obj_conv.inner = untag_ptr(this_obj);
34595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34597         Hostname_free(this_obj_conv);
34598 }
34599
34600 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
34601         LDKHostname ret_var = Hostname_clone(arg);
34602         int64_t ret_ref = 0;
34603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34605         return ret_ref;
34606 }
34607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34608         LDKHostname arg_conv;
34609         arg_conv.inner = untag_ptr(arg);
34610         arg_conv.is_owned = ptr_is_owned(arg);
34611         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34612         arg_conv.is_owned = false;
34613         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
34614         return ret_conv;
34615 }
34616
34617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34618         LDKHostname orig_conv;
34619         orig_conv.inner = untag_ptr(orig);
34620         orig_conv.is_owned = ptr_is_owned(orig);
34621         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34622         orig_conv.is_owned = false;
34623         LDKHostname ret_var = Hostname_clone(&orig_conv);
34624         int64_t ret_ref = 0;
34625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34627         return ret_ref;
34628 }
34629
34630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34631         LDKHostname a_conv;
34632         a_conv.inner = untag_ptr(a);
34633         a_conv.is_owned = ptr_is_owned(a);
34634         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34635         a_conv.is_owned = false;
34636         LDKHostname b_conv;
34637         b_conv.inner = untag_ptr(b);
34638         b_conv.is_owned = ptr_is_owned(b);
34639         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34640         b_conv.is_owned = false;
34641         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
34642         return ret_conv;
34643 }
34644
34645 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
34646         LDKHostname this_arg_conv;
34647         this_arg_conv.inner = untag_ptr(this_arg);
34648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34650         this_arg_conv.is_owned = false;
34651         int8_t ret_conv = Hostname_len(&this_arg_conv);
34652         return ret_conv;
34653 }
34654
34655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
34656         LDKHostname obj_conv;
34657         obj_conv.inner = untag_ptr(obj);
34658         obj_conv.is_owned = ptr_is_owned(obj);
34659         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34660         obj_conv.is_owned = false;
34661         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
34662         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34663         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34664         CVec_u8Z_free(ret_var);
34665         return ret_arr;
34666 }
34667
34668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34669         LDKu8slice ser_ref;
34670         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34671         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34672         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
34673         *ret_conv = Hostname_read(ser_ref);
34674         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34675         return tag_ptr(ret_conv, true);
34676 }
34677
34678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34679         LDKTransactionU16LenLimited this_obj_conv;
34680         this_obj_conv.inner = untag_ptr(this_obj);
34681         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34683         TransactionU16LenLimited_free(this_obj_conv);
34684 }
34685
34686 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
34687         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
34688         int64_t ret_ref = 0;
34689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34691         return ret_ref;
34692 }
34693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34694         LDKTransactionU16LenLimited arg_conv;
34695         arg_conv.inner = untag_ptr(arg);
34696         arg_conv.is_owned = ptr_is_owned(arg);
34697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34698         arg_conv.is_owned = false;
34699         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
34700         return ret_conv;
34701 }
34702
34703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34704         LDKTransactionU16LenLimited orig_conv;
34705         orig_conv.inner = untag_ptr(orig);
34706         orig_conv.is_owned = ptr_is_owned(orig);
34707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34708         orig_conv.is_owned = false;
34709         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
34710         int64_t ret_ref = 0;
34711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34713         return ret_ref;
34714 }
34715
34716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34717         LDKTransactionU16LenLimited a_conv;
34718         a_conv.inner = untag_ptr(a);
34719         a_conv.is_owned = ptr_is_owned(a);
34720         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34721         a_conv.is_owned = false;
34722         LDKTransactionU16LenLimited b_conv;
34723         b_conv.inner = untag_ptr(b);
34724         b_conv.is_owned = ptr_is_owned(b);
34725         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34726         b_conv.is_owned = false;
34727         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
34728         return ret_conv;
34729 }
34730
34731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
34732         LDKTransaction transaction_ref;
34733         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
34734         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
34735         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
34736         transaction_ref.data_is_owned = true;
34737         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
34738         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
34739         return tag_ptr(ret_conv, true);
34740 }
34741
34742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
34743         LDKTransactionU16LenLimited this_arg_conv;
34744         this_arg_conv.inner = untag_ptr(this_arg);
34745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34747         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
34748         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
34749         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34750         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34751         Transaction_free(ret_var);
34752         return ret_arr;
34753 }
34754
34755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
34756         LDKTransactionU16LenLimited obj_conv;
34757         obj_conv.inner = untag_ptr(obj);
34758         obj_conv.is_owned = ptr_is_owned(obj);
34759         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34760         obj_conv.is_owned = false;
34761         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
34762         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34763         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34764         CVec_u8Z_free(ret_var);
34765         return ret_arr;
34766 }
34767
34768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34769         LDKu8slice ser_ref;
34770         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34771         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34772         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
34773         *ret_conv = TransactionU16LenLimited_read(ser_ref);
34774         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34775         return tag_ptr(ret_conv, true);
34776 }
34777
34778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
34779         LDKu8slice msg_ref;
34780         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
34781         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
34782         uint8_t sk_arr[32];
34783         CHECK((*env)->GetArrayLength(env, sk) == 32);
34784         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
34785         uint8_t (*sk_ref)[32] = &sk_arr;
34786         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34787         *ret_conv = sign(msg_ref, sk_ref);
34788         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
34789         return tag_ptr(ret_conv, true);
34790 }
34791
34792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
34793         LDKu8slice msg_ref;
34794         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
34795         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
34796         LDKStr sig_conv = java_to_owned_str(env, sig);
34797         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
34798         *ret_conv = recover_pk(msg_ref, sig_conv);
34799         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
34800         return tag_ptr(ret_conv, true);
34801 }
34802
34803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
34804         LDKu8slice msg_ref;
34805         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
34806         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
34807         LDKStr sig_conv = java_to_owned_str(env, sig);
34808         LDKPublicKey pk_ref;
34809         CHECK((*env)->GetArrayLength(env, pk) == 33);
34810         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
34811         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
34812         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
34813         return ret_conv;
34814 }
34815
34816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
34817         LDKu8slice hrp_bytes_ref;
34818         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
34819         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
34820         LDKCVec_U5Z data_without_signature_constr;
34821         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
34822         if (data_without_signature_constr.datalen > 0)
34823                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
34824         else
34825                 data_without_signature_constr.data = NULL;
34826         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
34827         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
34828                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
34829                 
34830                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
34831         }
34832         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
34833         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
34834         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34835         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34836         CVec_u8Z_free(ret_var);
34837         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
34838         return ret_arr;
34839 }
34840
34841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KVStore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34842         if (!ptr_is_owned(this_ptr)) return;
34843         void* this_ptr_ptr = untag_ptr(this_ptr);
34844         CHECK_ACCESS(this_ptr_ptr);
34845         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
34846         FREE(untag_ptr(this_ptr));
34847         KVStore_free(this_ptr_conv);
34848 }
34849
34850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34851         if (!ptr_is_owned(this_ptr)) return;
34852         void* this_ptr_ptr = untag_ptr(this_ptr);
34853         CHECK_ACCESS(this_ptr_ptr);
34854         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
34855         FREE(untag_ptr(this_ptr));
34856         Persister_free(this_ptr_conv);
34857 }
34858
34859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_read_1channel_1monitors(JNIEnv *env, jclass clz, int64_t kv_store, int64_t entropy_source, int64_t signer_provider) {
34860         void* kv_store_ptr = untag_ptr(kv_store);
34861         CHECK_ACCESS(kv_store_ptr);
34862         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
34863         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
34864                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34865                 LDKKVStore_JCalls_cloned(&kv_store_conv);
34866         }
34867         void* entropy_source_ptr = untag_ptr(entropy_source);
34868         CHECK_ACCESS(entropy_source_ptr);
34869         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
34870         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
34871                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34872                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
34873         }
34874         void* signer_provider_ptr = untag_ptr(signer_provider);
34875         CHECK_ACCESS(signer_provider_ptr);
34876         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
34877         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
34878                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34879                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
34880         }
34881         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
34882         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
34883         return tag_ptr(ret_conv, true);
34884 }
34885
34886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34887         LDKMonitorUpdatingPersister this_obj_conv;
34888         this_obj_conv.inner = untag_ptr(this_obj);
34889         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34891         MonitorUpdatingPersister_free(this_obj_conv);
34892 }
34893
34894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1new(JNIEnv *env, jclass clz, int64_t kv_store, int64_t logger, int64_t maximum_pending_updates, int64_t entropy_source, int64_t signer_provider) {
34895         void* kv_store_ptr = untag_ptr(kv_store);
34896         CHECK_ACCESS(kv_store_ptr);
34897         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
34898         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
34899                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34900                 LDKKVStore_JCalls_cloned(&kv_store_conv);
34901         }
34902         void* logger_ptr = untag_ptr(logger);
34903         CHECK_ACCESS(logger_ptr);
34904         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34905         if (logger_conv.free == LDKLogger_JCalls_free) {
34906                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34907                 LDKLogger_JCalls_cloned(&logger_conv);
34908         }
34909         void* entropy_source_ptr = untag_ptr(entropy_source);
34910         CHECK_ACCESS(entropy_source_ptr);
34911         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
34912         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
34913                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34914                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
34915         }
34916         void* signer_provider_ptr = untag_ptr(signer_provider);
34917         CHECK_ACCESS(signer_provider_ptr);
34918         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
34919         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
34920                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34921                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
34922         }
34923         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
34924         int64_t ret_ref = 0;
34925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34927         return ret_ref;
34928 }
34929
34930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1read_1all_1channel_1monitors_1with_1updates(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator) {
34931         LDKMonitorUpdatingPersister this_arg_conv;
34932         this_arg_conv.inner = untag_ptr(this_arg);
34933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34935         this_arg_conv.is_owned = false;
34936         void* broadcaster_ptr = untag_ptr(broadcaster);
34937         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
34938         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
34939         void* fee_estimator_ptr = untag_ptr(fee_estimator);
34940         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
34941         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
34942         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
34943         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
34944         return tag_ptr(ret_conv, true);
34945 }
34946
34947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1read_1channel_1monitor_1with_1updates(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, jstring monitor_key) {
34948         LDKMonitorUpdatingPersister this_arg_conv;
34949         this_arg_conv.inner = untag_ptr(this_arg);
34950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34952         this_arg_conv.is_owned = false;
34953         void* broadcaster_ptr = untag_ptr(broadcaster);
34954         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
34955         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
34956         void* fee_estimator_ptr = untag_ptr(fee_estimator);
34957         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
34958         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
34959         LDKStr monitor_key_conv = java_to_owned_str(env, monitor_key);
34960         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
34961         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
34962         return tag_ptr(ret_conv, true);
34963 }
34964
34965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1cleanup_1stale_1updates(JNIEnv *env, jclass clz, int64_t this_arg, jboolean lazy) {
34966         LDKMonitorUpdatingPersister this_arg_conv;
34967         this_arg_conv.inner = untag_ptr(this_arg);
34968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34970         this_arg_conv.is_owned = false;
34971         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
34972         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
34973         return tag_ptr(ret_conv, true);
34974 }
34975
34976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
34977         LDKMonitorUpdatingPersister this_arg_conv;
34978         this_arg_conv.inner = untag_ptr(this_arg);
34979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34981         this_arg_conv.is_owned = false;
34982         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
34983         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
34984         return tag_ptr(ret_ret, true);
34985 }
34986
34987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34988         LDKUntrustedString this_obj_conv;
34989         this_obj_conv.inner = untag_ptr(this_obj);
34990         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34992         UntrustedString_free(this_obj_conv);
34993 }
34994
34995 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
34996         LDKUntrustedString this_ptr_conv;
34997         this_ptr_conv.inner = untag_ptr(this_ptr);
34998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35000         this_ptr_conv.is_owned = false;
35001         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
35002         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35003         Str_free(ret_str);
35004         return ret_conv;
35005 }
35006
35007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35008         LDKUntrustedString this_ptr_conv;
35009         this_ptr_conv.inner = untag_ptr(this_ptr);
35010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35012         this_ptr_conv.is_owned = false;
35013         LDKStr val_conv = java_to_owned_str(env, val);
35014         UntrustedString_set_a(&this_ptr_conv, val_conv);
35015 }
35016
35017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
35018         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
35019         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
35020         int64_t ret_ref = 0;
35021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35023         return ret_ref;
35024 }
35025
35026 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
35027         LDKUntrustedString ret_var = UntrustedString_clone(arg);
35028         int64_t ret_ref = 0;
35029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35031         return ret_ref;
35032 }
35033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35034         LDKUntrustedString arg_conv;
35035         arg_conv.inner = untag_ptr(arg);
35036         arg_conv.is_owned = ptr_is_owned(arg);
35037         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35038         arg_conv.is_owned = false;
35039         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
35040         return ret_conv;
35041 }
35042
35043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35044         LDKUntrustedString orig_conv;
35045         orig_conv.inner = untag_ptr(orig);
35046         orig_conv.is_owned = ptr_is_owned(orig);
35047         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35048         orig_conv.is_owned = false;
35049         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
35050         int64_t ret_ref = 0;
35051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35053         return ret_ref;
35054 }
35055
35056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35057         LDKUntrustedString a_conv;
35058         a_conv.inner = untag_ptr(a);
35059         a_conv.is_owned = ptr_is_owned(a);
35060         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35061         a_conv.is_owned = false;
35062         LDKUntrustedString b_conv;
35063         b_conv.inner = untag_ptr(b);
35064         b_conv.is_owned = ptr_is_owned(b);
35065         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35066         b_conv.is_owned = false;
35067         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
35068         return ret_conv;
35069 }
35070
35071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
35072         LDKUntrustedString obj_conv;
35073         obj_conv.inner = untag_ptr(obj);
35074         obj_conv.is_owned = ptr_is_owned(obj);
35075         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35076         obj_conv.is_owned = false;
35077         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
35078         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35079         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35080         CVec_u8Z_free(ret_var);
35081         return ret_arr;
35082 }
35083
35084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35085         LDKu8slice ser_ref;
35086         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35087         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35088         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35089         *ret_conv = UntrustedString_read(ser_ref);
35090         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35091         return tag_ptr(ret_conv, true);
35092 }
35093
35094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35095         LDKPrintableString this_obj_conv;
35096         this_obj_conv.inner = untag_ptr(this_obj);
35097         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35099         PrintableString_free(this_obj_conv);
35100 }
35101
35102 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
35103         LDKPrintableString this_ptr_conv;
35104         this_ptr_conv.inner = untag_ptr(this_ptr);
35105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35107         this_ptr_conv.is_owned = false;
35108         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
35109         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35110         Str_free(ret_str);
35111         return ret_conv;
35112 }
35113
35114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35115         LDKPrintableString this_ptr_conv;
35116         this_ptr_conv.inner = untag_ptr(this_ptr);
35117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35119         this_ptr_conv.is_owned = false;
35120         LDKStr val_conv = java_to_owned_str(env, val);
35121         PrintableString_set_a(&this_ptr_conv, val_conv);
35122 }
35123
35124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
35125         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
35126         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
35127         int64_t ret_ref = 0;
35128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35130         return ret_ref;
35131 }
35132
35133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35134         if (!ptr_is_owned(this_ptr)) return;
35135         void* this_ptr_ptr = untag_ptr(this_ptr);
35136         CHECK_ACCESS(this_ptr_ptr);
35137         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
35138         FREE(untag_ptr(this_ptr));
35139         FutureCallback_free(this_ptr_conv);
35140 }
35141
35142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35143         LDKFuture this_obj_conv;
35144         this_obj_conv.inner = untag_ptr(this_obj);
35145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35147         Future_free(this_obj_conv);
35148 }
35149
35150 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
35151         LDKFuture ret_var = Future_clone(arg);
35152         int64_t ret_ref = 0;
35153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35155         return ret_ref;
35156 }
35157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35158         LDKFuture arg_conv;
35159         arg_conv.inner = untag_ptr(arg);
35160         arg_conv.is_owned = ptr_is_owned(arg);
35161         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35162         arg_conv.is_owned = false;
35163         int64_t ret_conv = Future_clone_ptr(&arg_conv);
35164         return ret_conv;
35165 }
35166
35167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35168         LDKFuture orig_conv;
35169         orig_conv.inner = untag_ptr(orig);
35170         orig_conv.is_owned = ptr_is_owned(orig);
35171         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35172         orig_conv.is_owned = false;
35173         LDKFuture ret_var = Future_clone(&orig_conv);
35174         int64_t ret_ref = 0;
35175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35177         return ret_ref;
35178 }
35179
35180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
35181         LDKFuture this_arg_conv;
35182         this_arg_conv.inner = untag_ptr(this_arg);
35183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35185         this_arg_conv.is_owned = false;
35186         void* callback_ptr = untag_ptr(callback);
35187         CHECK_ACCESS(callback_ptr);
35188         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
35189         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
35190                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35191                 LDKFutureCallback_JCalls_cloned(&callback_conv);
35192         }
35193         Future_register_callback_fn(&this_arg_conv, callback_conv);
35194 }
35195
35196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
35197         LDKFuture this_arg_conv;
35198         this_arg_conv.inner = untag_ptr(this_arg);
35199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35201         this_arg_conv = Future_clone(&this_arg_conv);
35202         Future_wait(this_arg_conv);
35203 }
35204
35205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
35206         LDKFuture this_arg_conv;
35207         this_arg_conv.inner = untag_ptr(this_arg);
35208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35210         this_arg_conv = Future_clone(&this_arg_conv);
35211         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
35212         return ret_conv;
35213 }
35214
35215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35216         LDKSleeper this_obj_conv;
35217         this_obj_conv.inner = untag_ptr(this_obj);
35218         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35220         Sleeper_free(this_obj_conv);
35221 }
35222
35223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
35224         LDKFuture future_conv;
35225         future_conv.inner = untag_ptr(future);
35226         future_conv.is_owned = ptr_is_owned(future);
35227         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
35228         future_conv = Future_clone(&future_conv);
35229         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
35230         int64_t ret_ref = 0;
35231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35233         return ret_ref;
35234 }
35235
35236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1two_1futures(JNIEnv *env, jclass clz, int64_t fut_a, int64_t fut_b) {
35237         LDKFuture fut_a_conv;
35238         fut_a_conv.inner = untag_ptr(fut_a);
35239         fut_a_conv.is_owned = ptr_is_owned(fut_a);
35240         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
35241         fut_a_conv = Future_clone(&fut_a_conv);
35242         LDKFuture fut_b_conv;
35243         fut_b_conv.inner = untag_ptr(fut_b);
35244         fut_b_conv.is_owned = ptr_is_owned(fut_b);
35245         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
35246         fut_b_conv = Future_clone(&fut_b_conv);
35247         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
35248         int64_t ret_ref = 0;
35249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35251         return ret_ref;
35252 }
35253
35254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
35255         LDKCVec_FutureZ futures_constr;
35256         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
35257         if (futures_constr.datalen > 0)
35258                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
35259         else
35260                 futures_constr.data = NULL;
35261         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
35262         for (size_t i = 0; i < futures_constr.datalen; i++) {
35263                 int64_t futures_conv_8 = futures_vals[i];
35264                 LDKFuture futures_conv_8_conv;
35265                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
35266                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
35267                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
35268                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
35269                 futures_constr.data[i] = futures_conv_8_conv;
35270         }
35271         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
35272         LDKSleeper ret_var = Sleeper_new(futures_constr);
35273         int64_t ret_ref = 0;
35274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35276         return ret_ref;
35277 }
35278
35279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
35280         LDKSleeper this_arg_conv;
35281         this_arg_conv.inner = untag_ptr(this_arg);
35282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35284         this_arg_conv.is_owned = false;
35285         Sleeper_wait(&this_arg_conv);
35286 }
35287
35288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
35289         LDKSleeper this_arg_conv;
35290         this_arg_conv.inner = untag_ptr(this_arg);
35291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35293         this_arg_conv.is_owned = false;
35294         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
35295         return ret_conv;
35296 }
35297
35298 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35299         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
35300         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
35301         return ret_conv;
35302 }
35303
35304 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
35305         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
35306         return ret_conv;
35307 }
35308
35309 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
35310         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
35311         return ret_conv;
35312 }
35313
35314 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
35315         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
35316         return ret_conv;
35317 }
35318
35319 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
35320         jclass ret_conv = LDKLevel_to_java(env, Level_info());
35321         return ret_conv;
35322 }
35323
35324 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
35325         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
35326         return ret_conv;
35327 }
35328
35329 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
35330         jclass ret_conv = LDKLevel_to_java(env, Level_error());
35331         return ret_conv;
35332 }
35333
35334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35335         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
35336         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
35337         jboolean ret_conv = Level_eq(a_conv, b_conv);
35338         return ret_conv;
35339 }
35340
35341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
35342         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
35343         int64_t ret_conv = Level_hash(o_conv);
35344         return ret_conv;
35345 }
35346
35347 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
35348         jclass ret_conv = LDKLevel_to_java(env, Level_max());
35349         return ret_conv;
35350 }
35351
35352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35353         LDKRecord this_obj_conv;
35354         this_obj_conv.inner = untag_ptr(this_obj);
35355         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35357         Record_free(this_obj_conv);
35358 }
35359
35360 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
35361         LDKRecord this_ptr_conv;
35362         this_ptr_conv.inner = untag_ptr(this_ptr);
35363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35365         this_ptr_conv.is_owned = false;
35366         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
35367         return ret_conv;
35368 }
35369
35370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
35371         LDKRecord this_ptr_conv;
35372         this_ptr_conv.inner = untag_ptr(this_ptr);
35373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35375         this_ptr_conv.is_owned = false;
35376         LDKLevel val_conv = LDKLevel_from_java(env, val);
35377         Record_set_level(&this_ptr_conv, val_conv);
35378 }
35379
35380 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
35381         LDKRecord this_ptr_conv;
35382         this_ptr_conv.inner = untag_ptr(this_ptr);
35383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35385         this_ptr_conv.is_owned = false;
35386         LDKStr ret_str = Record_get_args(&this_ptr_conv);
35387         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35388         Str_free(ret_str);
35389         return ret_conv;
35390 }
35391
35392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35393         LDKRecord this_ptr_conv;
35394         this_ptr_conv.inner = untag_ptr(this_ptr);
35395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35397         this_ptr_conv.is_owned = false;
35398         LDKStr val_conv = java_to_owned_str(env, val);
35399         Record_set_args(&this_ptr_conv, val_conv);
35400 }
35401
35402 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
35403         LDKRecord this_ptr_conv;
35404         this_ptr_conv.inner = untag_ptr(this_ptr);
35405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35407         this_ptr_conv.is_owned = false;
35408         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
35409         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35410         Str_free(ret_str);
35411         return ret_conv;
35412 }
35413
35414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35415         LDKRecord this_ptr_conv;
35416         this_ptr_conv.inner = untag_ptr(this_ptr);
35417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35419         this_ptr_conv.is_owned = false;
35420         LDKStr val_conv = java_to_owned_str(env, val);
35421         Record_set_module_path(&this_ptr_conv, val_conv);
35422 }
35423
35424 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
35425         LDKRecord this_ptr_conv;
35426         this_ptr_conv.inner = untag_ptr(this_ptr);
35427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35429         this_ptr_conv.is_owned = false;
35430         LDKStr ret_str = Record_get_file(&this_ptr_conv);
35431         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35432         Str_free(ret_str);
35433         return ret_conv;
35434 }
35435
35436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35437         LDKRecord this_ptr_conv;
35438         this_ptr_conv.inner = untag_ptr(this_ptr);
35439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35441         this_ptr_conv.is_owned = false;
35442         LDKStr val_conv = java_to_owned_str(env, val);
35443         Record_set_file(&this_ptr_conv, val_conv);
35444 }
35445
35446 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
35447         LDKRecord this_ptr_conv;
35448         this_ptr_conv.inner = untag_ptr(this_ptr);
35449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35451         this_ptr_conv.is_owned = false;
35452         int32_t ret_conv = Record_get_line(&this_ptr_conv);
35453         return ret_conv;
35454 }
35455
35456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35457         LDKRecord this_ptr_conv;
35458         this_ptr_conv.inner = untag_ptr(this_ptr);
35459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35461         this_ptr_conv.is_owned = false;
35462         Record_set_line(&this_ptr_conv, val);
35463 }
35464
35465 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
35466         LDKRecord ret_var = Record_clone(arg);
35467         int64_t ret_ref = 0;
35468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35470         return ret_ref;
35471 }
35472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35473         LDKRecord arg_conv;
35474         arg_conv.inner = untag_ptr(arg);
35475         arg_conv.is_owned = ptr_is_owned(arg);
35476         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35477         arg_conv.is_owned = false;
35478         int64_t ret_conv = Record_clone_ptr(&arg_conv);
35479         return ret_conv;
35480 }
35481
35482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35483         LDKRecord orig_conv;
35484         orig_conv.inner = untag_ptr(orig);
35485         orig_conv.is_owned = ptr_is_owned(orig);
35486         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35487         orig_conv.is_owned = false;
35488         LDKRecord ret_var = Record_clone(&orig_conv);
35489         int64_t ret_ref = 0;
35490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35492         return ret_ref;
35493 }
35494
35495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35496         if (!ptr_is_owned(this_ptr)) return;
35497         void* this_ptr_ptr = untag_ptr(this_ptr);
35498         CHECK_ACCESS(this_ptr_ptr);
35499         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
35500         FREE(untag_ptr(this_ptr));
35501         Logger_free(this_ptr_conv);
35502 }
35503
35504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35505         LDKChannelHandshakeConfig this_obj_conv;
35506         this_obj_conv.inner = untag_ptr(this_obj);
35507         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35509         ChannelHandshakeConfig_free(this_obj_conv);
35510 }
35511
35512 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
35513         LDKChannelHandshakeConfig this_ptr_conv;
35514         this_ptr_conv.inner = untag_ptr(this_ptr);
35515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35517         this_ptr_conv.is_owned = false;
35518         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
35519         return ret_conv;
35520 }
35521
35522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35523         LDKChannelHandshakeConfig this_ptr_conv;
35524         this_ptr_conv.inner = untag_ptr(this_ptr);
35525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35527         this_ptr_conv.is_owned = false;
35528         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
35529 }
35530
35531 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
35532         LDKChannelHandshakeConfig this_ptr_conv;
35533         this_ptr_conv.inner = untag_ptr(this_ptr);
35534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35536         this_ptr_conv.is_owned = false;
35537         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
35538         return ret_conv;
35539 }
35540
35541 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) {
35542         LDKChannelHandshakeConfig this_ptr_conv;
35543         this_ptr_conv.inner = untag_ptr(this_ptr);
35544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35546         this_ptr_conv.is_owned = false;
35547         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
35548 }
35549
35550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35551         LDKChannelHandshakeConfig this_ptr_conv;
35552         this_ptr_conv.inner = untag_ptr(this_ptr);
35553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35555         this_ptr_conv.is_owned = false;
35556         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
35557         return ret_conv;
35558 }
35559
35560 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) {
35561         LDKChannelHandshakeConfig this_ptr_conv;
35562         this_ptr_conv.inner = untag_ptr(this_ptr);
35563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35565         this_ptr_conv.is_owned = false;
35566         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
35567 }
35568
35569 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1max_1inbound_1htlc_1value_1in_1flight_1percent_1of_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
35570         LDKChannelHandshakeConfig this_ptr_conv;
35571         this_ptr_conv.inner = untag_ptr(this_ptr);
35572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35574         this_ptr_conv.is_owned = false;
35575         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
35576         return ret_conv;
35577 }
35578
35579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1max_1inbound_1htlc_1value_1in_1flight_1percent_1of_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
35580         LDKChannelHandshakeConfig this_ptr_conv;
35581         this_ptr_conv.inner = untag_ptr(this_ptr);
35582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35584         this_ptr_conv.is_owned = false;
35585         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
35586 }
35587
35588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
35589         LDKChannelHandshakeConfig this_ptr_conv;
35590         this_ptr_conv.inner = untag_ptr(this_ptr);
35591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35593         this_ptr_conv.is_owned = false;
35594         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
35595         return ret_conv;
35596 }
35597
35598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35599         LDKChannelHandshakeConfig this_ptr_conv;
35600         this_ptr_conv.inner = untag_ptr(this_ptr);
35601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35603         this_ptr_conv.is_owned = false;
35604         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
35605 }
35606
35607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
35608         LDKChannelHandshakeConfig this_ptr_conv;
35609         this_ptr_conv.inner = untag_ptr(this_ptr);
35610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35612         this_ptr_conv.is_owned = false;
35613         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
35614         return ret_conv;
35615 }
35616
35617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35618         LDKChannelHandshakeConfig this_ptr_conv;
35619         this_ptr_conv.inner = untag_ptr(this_ptr);
35620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35622         this_ptr_conv.is_owned = false;
35623         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
35624 }
35625
35626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
35627         LDKChannelHandshakeConfig this_ptr_conv;
35628         this_ptr_conv.inner = untag_ptr(this_ptr);
35629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35631         this_ptr_conv.is_owned = false;
35632         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
35633         return ret_conv;
35634 }
35635
35636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35637         LDKChannelHandshakeConfig this_ptr_conv;
35638         this_ptr_conv.inner = untag_ptr(this_ptr);
35639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35641         this_ptr_conv.is_owned = false;
35642         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
35643 }
35644
35645 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
35646         LDKChannelHandshakeConfig this_ptr_conv;
35647         this_ptr_conv.inner = untag_ptr(this_ptr);
35648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35650         this_ptr_conv.is_owned = false;
35651         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
35652         return ret_conv;
35653 }
35654
35655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35656         LDKChannelHandshakeConfig this_ptr_conv;
35657         this_ptr_conv.inner = untag_ptr(this_ptr);
35658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35660         this_ptr_conv.is_owned = false;
35661         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
35662 }
35663
35664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
35665         LDKChannelHandshakeConfig this_ptr_conv;
35666         this_ptr_conv.inner = untag_ptr(this_ptr);
35667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35669         this_ptr_conv.is_owned = false;
35670         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
35671         return ret_conv;
35672 }
35673
35674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35675         LDKChannelHandshakeConfig this_ptr_conv;
35676         this_ptr_conv.inner = untag_ptr(this_ptr);
35677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35679         this_ptr_conv.is_owned = false;
35680         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
35681 }
35682
35683 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35684         LDKChannelHandshakeConfig this_ptr_conv;
35685         this_ptr_conv.inner = untag_ptr(this_ptr);
35686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35688         this_ptr_conv.is_owned = false;
35689         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
35690         return ret_conv;
35691 }
35692
35693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35694         LDKChannelHandshakeConfig this_ptr_conv;
35695         this_ptr_conv.inner = untag_ptr(this_ptr);
35696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35698         this_ptr_conv.is_owned = false;
35699         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
35700 }
35701
35702 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, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int32_t their_channel_reserve_proportional_millionths_arg, jboolean negotiate_anchors_zero_fee_htlc_tx_arg, int16_t our_max_accepted_htlcs_arg) {
35703         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, their_channel_reserve_proportional_millionths_arg, negotiate_anchors_zero_fee_htlc_tx_arg, our_max_accepted_htlcs_arg);
35704         int64_t ret_ref = 0;
35705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35707         return ret_ref;
35708 }
35709
35710 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
35711         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
35712         int64_t ret_ref = 0;
35713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35715         return ret_ref;
35716 }
35717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35718         LDKChannelHandshakeConfig arg_conv;
35719         arg_conv.inner = untag_ptr(arg);
35720         arg_conv.is_owned = ptr_is_owned(arg);
35721         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35722         arg_conv.is_owned = false;
35723         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
35724         return ret_conv;
35725 }
35726
35727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35728         LDKChannelHandshakeConfig orig_conv;
35729         orig_conv.inner = untag_ptr(orig);
35730         orig_conv.is_owned = ptr_is_owned(orig);
35731         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35732         orig_conv.is_owned = false;
35733         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
35734         int64_t ret_ref = 0;
35735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35737         return ret_ref;
35738 }
35739
35740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
35741         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
35742         int64_t ret_ref = 0;
35743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35745         return ret_ref;
35746 }
35747
35748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35749         LDKChannelHandshakeLimits this_obj_conv;
35750         this_obj_conv.inner = untag_ptr(this_obj);
35751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35753         ChannelHandshakeLimits_free(this_obj_conv);
35754 }
35755
35756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35757         LDKChannelHandshakeLimits this_ptr_conv;
35758         this_ptr_conv.inner = untag_ptr(this_ptr);
35759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35761         this_ptr_conv.is_owned = false;
35762         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
35763         return ret_conv;
35764 }
35765
35766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35767         LDKChannelHandshakeLimits this_ptr_conv;
35768         this_ptr_conv.inner = untag_ptr(this_ptr);
35769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35771         this_ptr_conv.is_owned = false;
35772         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
35773 }
35774
35775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35776         LDKChannelHandshakeLimits this_ptr_conv;
35777         this_ptr_conv.inner = untag_ptr(this_ptr);
35778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35780         this_ptr_conv.is_owned = false;
35781         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
35782         return ret_conv;
35783 }
35784
35785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35786         LDKChannelHandshakeLimits this_ptr_conv;
35787         this_ptr_conv.inner = untag_ptr(this_ptr);
35788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35790         this_ptr_conv.is_owned = false;
35791         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
35792 }
35793
35794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35795         LDKChannelHandshakeLimits this_ptr_conv;
35796         this_ptr_conv.inner = untag_ptr(this_ptr);
35797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35799         this_ptr_conv.is_owned = false;
35800         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
35801         return ret_conv;
35802 }
35803
35804 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) {
35805         LDKChannelHandshakeLimits this_ptr_conv;
35806         this_ptr_conv.inner = untag_ptr(this_ptr);
35807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35809         this_ptr_conv.is_owned = false;
35810         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
35811 }
35812
35813 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) {
35814         LDKChannelHandshakeLimits this_ptr_conv;
35815         this_ptr_conv.inner = untag_ptr(this_ptr);
35816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35818         this_ptr_conv.is_owned = false;
35819         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
35820         return ret_conv;
35821 }
35822
35823 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) {
35824         LDKChannelHandshakeLimits this_ptr_conv;
35825         this_ptr_conv.inner = untag_ptr(this_ptr);
35826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35828         this_ptr_conv.is_owned = false;
35829         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
35830 }
35831
35832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35833         LDKChannelHandshakeLimits this_ptr_conv;
35834         this_ptr_conv.inner = untag_ptr(this_ptr);
35835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35837         this_ptr_conv.is_owned = false;
35838         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
35839         return ret_conv;
35840 }
35841
35842 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) {
35843         LDKChannelHandshakeLimits this_ptr_conv;
35844         this_ptr_conv.inner = untag_ptr(this_ptr);
35845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35847         this_ptr_conv.is_owned = false;
35848         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
35849 }
35850
35851 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35852         LDKChannelHandshakeLimits this_ptr_conv;
35853         this_ptr_conv.inner = untag_ptr(this_ptr);
35854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35856         this_ptr_conv.is_owned = false;
35857         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
35858         return ret_conv;
35859 }
35860
35861 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) {
35862         LDKChannelHandshakeLimits this_ptr_conv;
35863         this_ptr_conv.inner = untag_ptr(this_ptr);
35864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35866         this_ptr_conv.is_owned = false;
35867         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
35868 }
35869
35870 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
35871         LDKChannelHandshakeLimits this_ptr_conv;
35872         this_ptr_conv.inner = untag_ptr(this_ptr);
35873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35875         this_ptr_conv.is_owned = false;
35876         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
35877         return ret_conv;
35878 }
35879
35880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35881         LDKChannelHandshakeLimits this_ptr_conv;
35882         this_ptr_conv.inner = untag_ptr(this_ptr);
35883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35885         this_ptr_conv.is_owned = false;
35886         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
35887 }
35888
35889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
35890         LDKChannelHandshakeLimits this_ptr_conv;
35891         this_ptr_conv.inner = untag_ptr(this_ptr);
35892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35894         this_ptr_conv.is_owned = false;
35895         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
35896         return ret_conv;
35897 }
35898
35899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35900         LDKChannelHandshakeLimits this_ptr_conv;
35901         this_ptr_conv.inner = untag_ptr(this_ptr);
35902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35904         this_ptr_conv.is_owned = false;
35905         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
35906 }
35907
35908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
35909         LDKChannelHandshakeLimits this_ptr_conv;
35910         this_ptr_conv.inner = untag_ptr(this_ptr);
35911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35913         this_ptr_conv.is_owned = false;
35914         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
35915         return ret_conv;
35916 }
35917
35918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35919         LDKChannelHandshakeLimits this_ptr_conv;
35920         this_ptr_conv.inner = untag_ptr(this_ptr);
35921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35923         this_ptr_conv.is_owned = false;
35924         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
35925 }
35926
35927 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
35928         LDKChannelHandshakeLimits this_ptr_conv;
35929         this_ptr_conv.inner = untag_ptr(this_ptr);
35930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35932         this_ptr_conv.is_owned = false;
35933         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
35934         return ret_conv;
35935 }
35936
35937 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) {
35938         LDKChannelHandshakeLimits this_ptr_conv;
35939         this_ptr_conv.inner = untag_ptr(this_ptr);
35940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35942         this_ptr_conv.is_owned = false;
35943         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
35944 }
35945
35946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_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, int32_t max_minimum_depth_arg, jboolean trust_own_funding_0conf_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
35947         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_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, max_minimum_depth_arg, trust_own_funding_0conf_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
35948         int64_t ret_ref = 0;
35949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35951         return ret_ref;
35952 }
35953
35954 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
35955         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
35956         int64_t ret_ref = 0;
35957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35959         return ret_ref;
35960 }
35961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35962         LDKChannelHandshakeLimits arg_conv;
35963         arg_conv.inner = untag_ptr(arg);
35964         arg_conv.is_owned = ptr_is_owned(arg);
35965         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35966         arg_conv.is_owned = false;
35967         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
35968         return ret_conv;
35969 }
35970
35971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35972         LDKChannelHandshakeLimits orig_conv;
35973         orig_conv.inner = untag_ptr(orig);
35974         orig_conv.is_owned = ptr_is_owned(orig);
35975         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35976         orig_conv.is_owned = false;
35977         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
35978         int64_t ret_ref = 0;
35979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35981         return ret_ref;
35982 }
35983
35984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
35985         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
35986         int64_t ret_ref = 0;
35987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35989         return ret_ref;
35990 }
35991
35992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35993         if (!ptr_is_owned(this_ptr)) return;
35994         void* this_ptr_ptr = untag_ptr(this_ptr);
35995         CHECK_ACCESS(this_ptr_ptr);
35996         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
35997         FREE(untag_ptr(this_ptr));
35998         MaxDustHTLCExposure_free(this_ptr_conv);
35999 }
36000
36001 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
36002         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36003         *ret_copy = MaxDustHTLCExposure_clone(arg);
36004         int64_t ret_ref = tag_ptr(ret_copy, true);
36005         return ret_ref;
36006 }
36007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36008         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
36009         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
36010         return ret_conv;
36011 }
36012
36013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36014         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
36015         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36016         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
36017         int64_t ret_ref = tag_ptr(ret_copy, true);
36018         return ret_ref;
36019 }
36020
36021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
36022         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36023         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
36024         int64_t ret_ref = tag_ptr(ret_copy, true);
36025         return ret_ref;
36026 }
36027
36028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
36029         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36030         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
36031         int64_t ret_ref = tag_ptr(ret_copy, true);
36032         return ret_ref;
36033 }
36034
36035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36036         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
36037         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
36038         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
36039         return ret_conv;
36040 }
36041
36042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
36043         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
36044         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
36045         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36046         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36047         CVec_u8Z_free(ret_var);
36048         return ret_arr;
36049 }
36050
36051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36052         LDKu8slice ser_ref;
36053         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36054         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36055         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
36056         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
36057         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36058         return tag_ptr(ret_conv, true);
36059 }
36060
36061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36062         LDKChannelConfig this_obj_conv;
36063         this_obj_conv.inner = untag_ptr(this_obj);
36064         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36066         ChannelConfig_free(this_obj_conv);
36067 }
36068
36069 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36070         LDKChannelConfig this_ptr_conv;
36071         this_ptr_conv.inner = untag_ptr(this_ptr);
36072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36074         this_ptr_conv.is_owned = false;
36075         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
36076         return ret_conv;
36077 }
36078
36079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36080         LDKChannelConfig this_ptr_conv;
36081         this_ptr_conv.inner = untag_ptr(this_ptr);
36082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36084         this_ptr_conv.is_owned = false;
36085         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
36086 }
36087
36088 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36089         LDKChannelConfig this_ptr_conv;
36090         this_ptr_conv.inner = untag_ptr(this_ptr);
36091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36093         this_ptr_conv.is_owned = false;
36094         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
36095         return ret_conv;
36096 }
36097
36098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36099         LDKChannelConfig this_ptr_conv;
36100         this_ptr_conv.inner = untag_ptr(this_ptr);
36101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36103         this_ptr_conv.is_owned = false;
36104         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
36105 }
36106
36107 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36108         LDKChannelConfig this_ptr_conv;
36109         this_ptr_conv.inner = untag_ptr(this_ptr);
36110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36112         this_ptr_conv.is_owned = false;
36113         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
36114         return ret_conv;
36115 }
36116
36117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36118         LDKChannelConfig this_ptr_conv;
36119         this_ptr_conv.inner = untag_ptr(this_ptr);
36120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36122         this_ptr_conv.is_owned = false;
36123         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
36124 }
36125
36126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
36127         LDKChannelConfig this_ptr_conv;
36128         this_ptr_conv.inner = untag_ptr(this_ptr);
36129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36131         this_ptr_conv.is_owned = false;
36132         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36133         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
36134         int64_t ret_ref = tag_ptr(ret_copy, true);
36135         return ret_ref;
36136 }
36137
36138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36139         LDKChannelConfig this_ptr_conv;
36140         this_ptr_conv.inner = untag_ptr(this_ptr);
36141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36143         this_ptr_conv.is_owned = false;
36144         void* val_ptr = untag_ptr(val);
36145         CHECK_ACCESS(val_ptr);
36146         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
36147         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
36148         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
36149 }
36150
36151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36152         LDKChannelConfig this_ptr_conv;
36153         this_ptr_conv.inner = untag_ptr(this_ptr);
36154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36156         this_ptr_conv.is_owned = false;
36157         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
36158         return ret_conv;
36159 }
36160
36161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36162         LDKChannelConfig this_ptr_conv;
36163         this_ptr_conv.inner = untag_ptr(this_ptr);
36164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36166         this_ptr_conv.is_owned = false;
36167         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
36168 }
36169
36170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36171         LDKChannelConfig this_ptr_conv;
36172         this_ptr_conv.inner = untag_ptr(this_ptr);
36173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36175         this_ptr_conv.is_owned = false;
36176         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
36177         return ret_conv;
36178 }
36179
36180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36181         LDKChannelConfig this_ptr_conv;
36182         this_ptr_conv.inner = untag_ptr(this_ptr);
36183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36185         this_ptr_conv.is_owned = false;
36186         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
36187 }
36188
36189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_arg, int64_t force_close_avoidance_max_fee_satoshis_arg, jboolean accept_underpaying_htlcs_arg) {
36190         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
36191         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
36192         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
36193         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
36194         LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_arg_conv, force_close_avoidance_max_fee_satoshis_arg, accept_underpaying_htlcs_arg);
36195         int64_t ret_ref = 0;
36196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36198         return ret_ref;
36199 }
36200
36201 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
36202         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
36203         int64_t ret_ref = 0;
36204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36206         return ret_ref;
36207 }
36208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36209         LDKChannelConfig arg_conv;
36210         arg_conv.inner = untag_ptr(arg);
36211         arg_conv.is_owned = ptr_is_owned(arg);
36212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36213         arg_conv.is_owned = false;
36214         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
36215         return ret_conv;
36216 }
36217
36218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36219         LDKChannelConfig orig_conv;
36220         orig_conv.inner = untag_ptr(orig);
36221         orig_conv.is_owned = ptr_is_owned(orig);
36222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36223         orig_conv.is_owned = false;
36224         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
36225         int64_t ret_ref = 0;
36226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36228         return ret_ref;
36229 }
36230
36231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36232         LDKChannelConfig a_conv;
36233         a_conv.inner = untag_ptr(a);
36234         a_conv.is_owned = ptr_is_owned(a);
36235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36236         a_conv.is_owned = false;
36237         LDKChannelConfig b_conv;
36238         b_conv.inner = untag_ptr(b);
36239         b_conv.is_owned = ptr_is_owned(b);
36240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36241         b_conv.is_owned = false;
36242         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
36243         return ret_conv;
36244 }
36245
36246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
36247         LDKChannelConfig this_arg_conv;
36248         this_arg_conv.inner = untag_ptr(this_arg);
36249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36251         this_arg_conv.is_owned = false;
36252         LDKChannelConfigUpdate update_conv;
36253         update_conv.inner = untag_ptr(update);
36254         update_conv.is_owned = ptr_is_owned(update);
36255         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
36256         update_conv.is_owned = false;
36257         ChannelConfig_apply(&this_arg_conv, &update_conv);
36258 }
36259
36260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
36261         LDKChannelConfig ret_var = ChannelConfig_default();
36262         int64_t ret_ref = 0;
36263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36265         return ret_ref;
36266 }
36267
36268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
36269         LDKChannelConfig obj_conv;
36270         obj_conv.inner = untag_ptr(obj);
36271         obj_conv.is_owned = ptr_is_owned(obj);
36272         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36273         obj_conv.is_owned = false;
36274         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
36275         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36276         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36277         CVec_u8Z_free(ret_var);
36278         return ret_arr;
36279 }
36280
36281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36282         LDKu8slice ser_ref;
36283         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36284         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36285         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
36286         *ret_conv = ChannelConfig_read(ser_ref);
36287         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36288         return tag_ptr(ret_conv, true);
36289 }
36290
36291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36292         LDKChannelConfigUpdate this_obj_conv;
36293         this_obj_conv.inner = untag_ptr(this_obj);
36294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36296         ChannelConfigUpdate_free(this_obj_conv);
36297 }
36298
36299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36300         LDKChannelConfigUpdate this_ptr_conv;
36301         this_ptr_conv.inner = untag_ptr(this_ptr);
36302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36304         this_ptr_conv.is_owned = false;
36305         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36306         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
36307         int64_t ret_ref = tag_ptr(ret_copy, true);
36308         return ret_ref;
36309 }
36310
36311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36312         LDKChannelConfigUpdate this_ptr_conv;
36313         this_ptr_conv.inner = untag_ptr(this_ptr);
36314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36316         this_ptr_conv.is_owned = false;
36317         void* val_ptr = untag_ptr(val);
36318         CHECK_ACCESS(val_ptr);
36319         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36320         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36321         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
36322 }
36323
36324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36325         LDKChannelConfigUpdate this_ptr_conv;
36326         this_ptr_conv.inner = untag_ptr(this_ptr);
36327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36329         this_ptr_conv.is_owned = false;
36330         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36331         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
36332         int64_t ret_ref = tag_ptr(ret_copy, true);
36333         return ret_ref;
36334 }
36335
36336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36337         LDKChannelConfigUpdate this_ptr_conv;
36338         this_ptr_conv.inner = untag_ptr(this_ptr);
36339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36341         this_ptr_conv.is_owned = false;
36342         void* val_ptr = untag_ptr(val);
36343         CHECK_ACCESS(val_ptr);
36344         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36345         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36346         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
36347 }
36348
36349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36350         LDKChannelConfigUpdate this_ptr_conv;
36351         this_ptr_conv.inner = untag_ptr(this_ptr);
36352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36354         this_ptr_conv.is_owned = false;
36355         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
36356         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
36357         int64_t ret_ref = tag_ptr(ret_copy, true);
36358         return ret_ref;
36359 }
36360
36361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36362         LDKChannelConfigUpdate this_ptr_conv;
36363         this_ptr_conv.inner = untag_ptr(this_ptr);
36364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36366         this_ptr_conv.is_owned = false;
36367         void* val_ptr = untag_ptr(val);
36368         CHECK_ACCESS(val_ptr);
36369         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
36370         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
36371         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
36372 }
36373
36374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36375         LDKChannelConfigUpdate this_ptr_conv;
36376         this_ptr_conv.inner = untag_ptr(this_ptr);
36377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36379         this_ptr_conv.is_owned = false;
36380         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
36381         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
36382         int64_t ret_ref = tag_ptr(ret_copy, true);
36383         return ret_ref;
36384 }
36385
36386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36387         LDKChannelConfigUpdate this_ptr_conv;
36388         this_ptr_conv.inner = untag_ptr(this_ptr);
36389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36391         this_ptr_conv.is_owned = false;
36392         void* val_ptr = untag_ptr(val);
36393         CHECK_ACCESS(val_ptr);
36394         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
36395         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
36396         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
36397 }
36398
36399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36400         LDKChannelConfigUpdate this_ptr_conv;
36401         this_ptr_conv.inner = untag_ptr(this_ptr);
36402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36404         this_ptr_conv.is_owned = false;
36405         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36406         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
36407         int64_t ret_ref = tag_ptr(ret_copy, true);
36408         return ret_ref;
36409 }
36410
36411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36412         LDKChannelConfigUpdate this_ptr_conv;
36413         this_ptr_conv.inner = untag_ptr(this_ptr);
36414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36416         this_ptr_conv.is_owned = false;
36417         void* val_ptr = untag_ptr(val);
36418         CHECK_ACCESS(val_ptr);
36419         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36420         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36421         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
36422 }
36423
36424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1new(JNIEnv *env, jclass clz, int64_t forwarding_fee_proportional_millionths_arg, int64_t forwarding_fee_base_msat_arg, int64_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
36425         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
36426         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
36427         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
36428         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
36429         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
36430         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
36431         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
36432         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
36433         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
36434         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
36435         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
36436         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
36437         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
36438         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
36439         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
36440         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
36441         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
36442         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
36443         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
36444         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
36445         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_new(forwarding_fee_proportional_millionths_arg_conv, forwarding_fee_base_msat_arg_conv, cltv_expiry_delta_arg_conv, max_dust_htlc_exposure_msat_arg_conv, force_close_avoidance_max_fee_satoshis_arg_conv);
36446         int64_t ret_ref = 0;
36447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36449         return ret_ref;
36450 }
36451
36452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
36453         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
36454         int64_t ret_ref = 0;
36455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36457         return ret_ref;
36458 }
36459
36460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36461         LDKUserConfig this_obj_conv;
36462         this_obj_conv.inner = untag_ptr(this_obj);
36463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36465         UserConfig_free(this_obj_conv);
36466 }
36467
36468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
36469         LDKUserConfig this_ptr_conv;
36470         this_ptr_conv.inner = untag_ptr(this_ptr);
36471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36473         this_ptr_conv.is_owned = false;
36474         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
36475         int64_t ret_ref = 0;
36476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36478         return ret_ref;
36479 }
36480
36481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36482         LDKUserConfig this_ptr_conv;
36483         this_ptr_conv.inner = untag_ptr(this_ptr);
36484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36486         this_ptr_conv.is_owned = false;
36487         LDKChannelHandshakeConfig val_conv;
36488         val_conv.inner = untag_ptr(val);
36489         val_conv.is_owned = ptr_is_owned(val);
36490         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36491         val_conv = ChannelHandshakeConfig_clone(&val_conv);
36492         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
36493 }
36494
36495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
36496         LDKUserConfig this_ptr_conv;
36497         this_ptr_conv.inner = untag_ptr(this_ptr);
36498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36500         this_ptr_conv.is_owned = false;
36501         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
36502         int64_t ret_ref = 0;
36503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36505         return ret_ref;
36506 }
36507
36508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36509         LDKUserConfig this_ptr_conv;
36510         this_ptr_conv.inner = untag_ptr(this_ptr);
36511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36513         this_ptr_conv.is_owned = false;
36514         LDKChannelHandshakeLimits val_conv;
36515         val_conv.inner = untag_ptr(val);
36516         val_conv.is_owned = ptr_is_owned(val);
36517         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36518         val_conv = ChannelHandshakeLimits_clone(&val_conv);
36519         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
36520 }
36521
36522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
36523         LDKUserConfig this_ptr_conv;
36524         this_ptr_conv.inner = untag_ptr(this_ptr);
36525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36527         this_ptr_conv.is_owned = false;
36528         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
36529         int64_t ret_ref = 0;
36530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36532         return ret_ref;
36533 }
36534
36535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36536         LDKUserConfig this_ptr_conv;
36537         this_ptr_conv.inner = untag_ptr(this_ptr);
36538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36540         this_ptr_conv.is_owned = false;
36541         LDKChannelConfig val_conv;
36542         val_conv.inner = untag_ptr(val);
36543         val_conv.is_owned = ptr_is_owned(val);
36544         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36545         val_conv = ChannelConfig_clone(&val_conv);
36546         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
36547 }
36548
36549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
36550         LDKUserConfig this_ptr_conv;
36551         this_ptr_conv.inner = untag_ptr(this_ptr);
36552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36554         this_ptr_conv.is_owned = false;
36555         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
36556         return ret_conv;
36557 }
36558
36559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36560         LDKUserConfig this_ptr_conv;
36561         this_ptr_conv.inner = untag_ptr(this_ptr);
36562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36564         this_ptr_conv.is_owned = false;
36565         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
36566 }
36567
36568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
36569         LDKUserConfig this_ptr_conv;
36570         this_ptr_conv.inner = untag_ptr(this_ptr);
36571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36573         this_ptr_conv.is_owned = false;
36574         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
36575         return ret_conv;
36576 }
36577
36578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36579         LDKUserConfig this_ptr_conv;
36580         this_ptr_conv.inner = untag_ptr(this_ptr);
36581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36583         this_ptr_conv.is_owned = false;
36584         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
36585 }
36586
36587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
36588         LDKUserConfig this_ptr_conv;
36589         this_ptr_conv.inner = untag_ptr(this_ptr);
36590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36592         this_ptr_conv.is_owned = false;
36593         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
36594         return ret_conv;
36595 }
36596
36597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36598         LDKUserConfig this_ptr_conv;
36599         this_ptr_conv.inner = untag_ptr(this_ptr);
36600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36602         this_ptr_conv.is_owned = false;
36603         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
36604 }
36605
36606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36607         LDKUserConfig this_ptr_conv;
36608         this_ptr_conv.inner = untag_ptr(this_ptr);
36609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36611         this_ptr_conv.is_owned = false;
36612         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
36613         return ret_conv;
36614 }
36615
36616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36617         LDKUserConfig this_ptr_conv;
36618         this_ptr_conv.inner = untag_ptr(this_ptr);
36619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36621         this_ptr_conv.is_owned = false;
36622         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
36623 }
36624
36625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
36626         LDKUserConfig this_ptr_conv;
36627         this_ptr_conv.inner = untag_ptr(this_ptr);
36628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36630         this_ptr_conv.is_owned = false;
36631         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
36632         return ret_conv;
36633 }
36634
36635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36636         LDKUserConfig this_ptr_conv;
36637         this_ptr_conv.inner = untag_ptr(this_ptr);
36638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36640         this_ptr_conv.is_owned = false;
36641         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
36642 }
36643
36644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t channel_handshake_config_arg, int64_t channel_handshake_limits_arg, int64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg, jboolean accept_intercept_htlcs_arg, jboolean accept_mpp_keysend_arg) {
36645         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
36646         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
36647         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
36648         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
36649         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
36650         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
36651         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
36652         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
36653         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
36654         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
36655         LDKChannelConfig channel_config_arg_conv;
36656         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
36657         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
36658         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
36659         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
36660         LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg, accept_intercept_htlcs_arg, accept_mpp_keysend_arg);
36661         int64_t ret_ref = 0;
36662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36664         return ret_ref;
36665 }
36666
36667 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
36668         LDKUserConfig ret_var = UserConfig_clone(arg);
36669         int64_t ret_ref = 0;
36670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36672         return ret_ref;
36673 }
36674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36675         LDKUserConfig arg_conv;
36676         arg_conv.inner = untag_ptr(arg);
36677         arg_conv.is_owned = ptr_is_owned(arg);
36678         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36679         arg_conv.is_owned = false;
36680         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
36681         return ret_conv;
36682 }
36683
36684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36685         LDKUserConfig orig_conv;
36686         orig_conv.inner = untag_ptr(orig);
36687         orig_conv.is_owned = ptr_is_owned(orig);
36688         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36689         orig_conv.is_owned = false;
36690         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
36691         int64_t ret_ref = 0;
36692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36694         return ret_ref;
36695 }
36696
36697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
36698         LDKUserConfig ret_var = UserConfig_default();
36699         int64_t ret_ref = 0;
36700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36702         return ret_ref;
36703 }
36704
36705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36706         LDKBestBlock this_obj_conv;
36707         this_obj_conv.inner = untag_ptr(this_obj);
36708         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36710         BestBlock_free(this_obj_conv);
36711 }
36712
36713 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
36714         LDKBestBlock ret_var = BestBlock_clone(arg);
36715         int64_t ret_ref = 0;
36716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36718         return ret_ref;
36719 }
36720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36721         LDKBestBlock arg_conv;
36722         arg_conv.inner = untag_ptr(arg);
36723         arg_conv.is_owned = ptr_is_owned(arg);
36724         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36725         arg_conv.is_owned = false;
36726         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
36727         return ret_conv;
36728 }
36729
36730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36731         LDKBestBlock orig_conv;
36732         orig_conv.inner = untag_ptr(orig);
36733         orig_conv.is_owned = ptr_is_owned(orig);
36734         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36735         orig_conv.is_owned = false;
36736         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
36737         int64_t ret_ref = 0;
36738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36740         return ret_ref;
36741 }
36742
36743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36744         LDKBestBlock a_conv;
36745         a_conv.inner = untag_ptr(a);
36746         a_conv.is_owned = ptr_is_owned(a);
36747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36748         a_conv.is_owned = false;
36749         LDKBestBlock b_conv;
36750         b_conv.inner = untag_ptr(b);
36751         b_conv.is_owned = ptr_is_owned(b);
36752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36753         b_conv.is_owned = false;
36754         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
36755         return ret_conv;
36756 }
36757
36758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
36759         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
36760         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
36761         int64_t ret_ref = 0;
36762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36764         return ret_ref;
36765 }
36766
36767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
36768         LDKThirtyTwoBytes block_hash_ref;
36769         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
36770         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
36771         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
36772         int64_t ret_ref = 0;
36773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36775         return ret_ref;
36776 }
36777
36778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
36779         LDKBestBlock this_arg_conv;
36780         this_arg_conv.inner = untag_ptr(this_arg);
36781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36783         this_arg_conv.is_owned = false;
36784         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36785         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
36786         return ret_arr;
36787 }
36788
36789 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
36790         LDKBestBlock this_arg_conv;
36791         this_arg_conv.inner = untag_ptr(this_arg);
36792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36794         this_arg_conv.is_owned = false;
36795         int32_t ret_conv = BestBlock_height(&this_arg_conv);
36796         return ret_conv;
36797 }
36798
36799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36800         if (!ptr_is_owned(this_ptr)) return;
36801         void* this_ptr_ptr = untag_ptr(this_ptr);
36802         CHECK_ACCESS(this_ptr_ptr);
36803         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
36804         FREE(untag_ptr(this_ptr));
36805         Listen_free(this_ptr_conv);
36806 }
36807
36808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36809         if (!ptr_is_owned(this_ptr)) return;
36810         void* this_ptr_ptr = untag_ptr(this_ptr);
36811         CHECK_ACCESS(this_ptr_ptr);
36812         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
36813         FREE(untag_ptr(this_ptr));
36814         Confirm_free(this_ptr_conv);
36815 }
36816
36817 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36818         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
36819         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
36820         return ret_conv;
36821 }
36822
36823 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
36824         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
36825         return ret_conv;
36826 }
36827
36828 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
36829         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
36830         return ret_conv;
36831 }
36832
36833 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1unrecoverable_1error(JNIEnv *env, jclass clz) {
36834         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_unrecoverable_error());
36835         return ret_conv;
36836 }
36837
36838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36839         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
36840         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
36841         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
36842         return ret_conv;
36843 }
36844
36845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36846         if (!ptr_is_owned(this_ptr)) return;
36847         void* this_ptr_ptr = untag_ptr(this_ptr);
36848         CHECK_ACCESS(this_ptr_ptr);
36849         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
36850         FREE(untag_ptr(this_ptr));
36851         Watch_free(this_ptr_conv);
36852 }
36853
36854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36855         if (!ptr_is_owned(this_ptr)) return;
36856         void* this_ptr_ptr = untag_ptr(this_ptr);
36857         CHECK_ACCESS(this_ptr_ptr);
36858         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
36859         FREE(untag_ptr(this_ptr));
36860         Filter_free(this_ptr_conv);
36861 }
36862
36863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36864         LDKWatchedOutput this_obj_conv;
36865         this_obj_conv.inner = untag_ptr(this_obj);
36866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36868         WatchedOutput_free(this_obj_conv);
36869 }
36870
36871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36872         LDKWatchedOutput this_ptr_conv;
36873         this_ptr_conv.inner = untag_ptr(this_ptr);
36874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36876         this_ptr_conv.is_owned = false;
36877         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
36878         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
36879         int64_t ret_ref = tag_ptr(ret_copy, true);
36880         return ret_ref;
36881 }
36882
36883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36884         LDKWatchedOutput this_ptr_conv;
36885         this_ptr_conv.inner = untag_ptr(this_ptr);
36886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36888         this_ptr_conv.is_owned = false;
36889         void* val_ptr = untag_ptr(val);
36890         CHECK_ACCESS(val_ptr);
36891         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
36892         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
36893         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
36894 }
36895
36896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
36897         LDKWatchedOutput this_ptr_conv;
36898         this_ptr_conv.inner = untag_ptr(this_ptr);
36899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36901         this_ptr_conv.is_owned = false;
36902         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
36903         int64_t ret_ref = 0;
36904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36906         return ret_ref;
36907 }
36908
36909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36910         LDKWatchedOutput this_ptr_conv;
36911         this_ptr_conv.inner = untag_ptr(this_ptr);
36912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36914         this_ptr_conv.is_owned = false;
36915         LDKOutPoint val_conv;
36916         val_conv.inner = untag_ptr(val);
36917         val_conv.is_owned = ptr_is_owned(val);
36918         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36919         val_conv = OutPoint_clone(&val_conv);
36920         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
36921 }
36922
36923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
36924         LDKWatchedOutput this_ptr_conv;
36925         this_ptr_conv.inner = untag_ptr(this_ptr);
36926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36928         this_ptr_conv.is_owned = false;
36929         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
36930         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36931         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36932         return ret_arr;
36933 }
36934
36935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36936         LDKWatchedOutput this_ptr_conv;
36937         this_ptr_conv.inner = untag_ptr(this_ptr);
36938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36940         this_ptr_conv.is_owned = false;
36941         LDKCVec_u8Z val_ref;
36942         val_ref.datalen = (*env)->GetArrayLength(env, val);
36943         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
36944         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
36945         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
36946 }
36947
36948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv *env, jclass clz, int64_t block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
36949         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
36950         CHECK_ACCESS(block_hash_arg_ptr);
36951         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
36952         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
36953         LDKOutPoint outpoint_arg_conv;
36954         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
36955         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
36956         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
36957         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
36958         LDKCVec_u8Z script_pubkey_arg_ref;
36959         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
36960         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
36961         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
36962         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
36963         int64_t ret_ref = 0;
36964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36966         return ret_ref;
36967 }
36968
36969 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
36970         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
36971         int64_t ret_ref = 0;
36972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36974         return ret_ref;
36975 }
36976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36977         LDKWatchedOutput arg_conv;
36978         arg_conv.inner = untag_ptr(arg);
36979         arg_conv.is_owned = ptr_is_owned(arg);
36980         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36981         arg_conv.is_owned = false;
36982         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
36983         return ret_conv;
36984 }
36985
36986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36987         LDKWatchedOutput orig_conv;
36988         orig_conv.inner = untag_ptr(orig);
36989         orig_conv.is_owned = ptr_is_owned(orig);
36990         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36991         orig_conv.is_owned = false;
36992         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
36993         int64_t ret_ref = 0;
36994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36996         return ret_ref;
36997 }
36998
36999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37000         LDKWatchedOutput a_conv;
37001         a_conv.inner = untag_ptr(a);
37002         a_conv.is_owned = ptr_is_owned(a);
37003         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37004         a_conv.is_owned = false;
37005         LDKWatchedOutput b_conv;
37006         b_conv.inner = untag_ptr(b);
37007         b_conv.is_owned = ptr_is_owned(b);
37008         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37009         b_conv.is_owned = false;
37010         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
37011         return ret_conv;
37012 }
37013
37014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
37015         LDKWatchedOutput o_conv;
37016         o_conv.inner = untag_ptr(o);
37017         o_conv.is_owned = ptr_is_owned(o);
37018         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37019         o_conv.is_owned = false;
37020         int64_t ret_conv = WatchedOutput_hash(&o_conv);
37021         return ret_conv;
37022 }
37023
37024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37025         if (!ptr_is_owned(this_ptr)) return;
37026         void* this_ptr_ptr = untag_ptr(this_ptr);
37027         CHECK_ACCESS(this_ptr_ptr);
37028         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
37029         FREE(untag_ptr(this_ptr));
37030         BroadcasterInterface_free(this_ptr_conv);
37031 }
37032
37033 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37034         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
37035         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
37036         return ret_conv;
37037 }
37038
37039 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1mempool_1minimum(JNIEnv *env, jclass clz) {
37040         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_mempool_minimum());
37041         return ret_conv;
37042 }
37043
37044 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
37045         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
37046         return ret_conv;
37047 }
37048
37049 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
37050         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
37051         return ret_conv;
37052 }
37053
37054 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
37055         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
37056         return ret_conv;
37057 }
37058
37059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
37060         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
37061         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
37062         return ret_conv;
37063 }
37064
37065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37066         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
37067         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
37068         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
37069         return ret_conv;
37070 }
37071
37072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37073         if (!ptr_is_owned(this_ptr)) return;
37074         void* this_ptr_ptr = untag_ptr(this_ptr);
37075         CHECK_ACCESS(this_ptr_ptr);
37076         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
37077         FREE(untag_ptr(this_ptr));
37078         FeeEstimator_free(this_ptr_conv);
37079 }
37080
37081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37082         LDKMonitorUpdateId this_obj_conv;
37083         this_obj_conv.inner = untag_ptr(this_obj);
37084         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37086         MonitorUpdateId_free(this_obj_conv);
37087 }
37088
37089 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
37090         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
37091         int64_t ret_ref = 0;
37092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37094         return ret_ref;
37095 }
37096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37097         LDKMonitorUpdateId arg_conv;
37098         arg_conv.inner = untag_ptr(arg);
37099         arg_conv.is_owned = ptr_is_owned(arg);
37100         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37101         arg_conv.is_owned = false;
37102         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
37103         return ret_conv;
37104 }
37105
37106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37107         LDKMonitorUpdateId orig_conv;
37108         orig_conv.inner = untag_ptr(orig);
37109         orig_conv.is_owned = ptr_is_owned(orig);
37110         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37111         orig_conv.is_owned = false;
37112         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
37113         int64_t ret_ref = 0;
37114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37116         return ret_ref;
37117 }
37118
37119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
37120         LDKMonitorUpdateId o_conv;
37121         o_conv.inner = untag_ptr(o);
37122         o_conv.is_owned = ptr_is_owned(o);
37123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37124         o_conv.is_owned = false;
37125         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
37126         return ret_conv;
37127 }
37128
37129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37130         LDKMonitorUpdateId a_conv;
37131         a_conv.inner = untag_ptr(a);
37132         a_conv.is_owned = ptr_is_owned(a);
37133         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37134         a_conv.is_owned = false;
37135         LDKMonitorUpdateId b_conv;
37136         b_conv.inner = untag_ptr(b);
37137         b_conv.is_owned = ptr_is_owned(b);
37138         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37139         b_conv.is_owned = false;
37140         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
37141         return ret_conv;
37142 }
37143
37144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37145         if (!ptr_is_owned(this_ptr)) return;
37146         void* this_ptr_ptr = untag_ptr(this_ptr);
37147         CHECK_ACCESS(this_ptr_ptr);
37148         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
37149         FREE(untag_ptr(this_ptr));
37150         Persist_free(this_ptr_conv);
37151 }
37152
37153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37154         LDKLockedChannelMonitor this_obj_conv;
37155         this_obj_conv.inner = untag_ptr(this_obj);
37156         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37158         LockedChannelMonitor_free(this_obj_conv);
37159 }
37160
37161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37162         LDKChainMonitor this_obj_conv;
37163         this_obj_conv.inner = untag_ptr(this_obj);
37164         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37166         ChainMonitor_free(this_obj_conv);
37167 }
37168
37169 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) {
37170         void* chain_source_ptr = untag_ptr(chain_source);
37171         CHECK_ACCESS(chain_source_ptr);
37172         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
37173         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
37174         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
37175                 // Manually implement clone for Java trait instances
37176                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
37177                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37178                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
37179                 }
37180         }
37181         void* broadcaster_ptr = untag_ptr(broadcaster);
37182         CHECK_ACCESS(broadcaster_ptr);
37183         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
37184         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
37185                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37186                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
37187         }
37188         void* logger_ptr = untag_ptr(logger);
37189         CHECK_ACCESS(logger_ptr);
37190         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37191         if (logger_conv.free == LDKLogger_JCalls_free) {
37192                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37193                 LDKLogger_JCalls_cloned(&logger_conv);
37194         }
37195         void* feeest_ptr = untag_ptr(feeest);
37196         CHECK_ACCESS(feeest_ptr);
37197         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
37198         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
37199                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37200                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
37201         }
37202         void* persister_ptr = untag_ptr(persister);
37203         CHECK_ACCESS(persister_ptr);
37204         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
37205         if (persister_conv.free == LDKPersist_JCalls_free) {
37206                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37207                 LDKPersist_JCalls_cloned(&persister_conv);
37208         }
37209         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
37210         int64_t ret_ref = 0;
37211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37213         return ret_ref;
37214 }
37215
37216 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray ignored_channels) {
37217         LDKChainMonitor this_arg_conv;
37218         this_arg_conv.inner = untag_ptr(this_arg);
37219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37221         this_arg_conv.is_owned = false;
37222         LDKCVec_ChannelDetailsZ ignored_channels_constr;
37223         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
37224         if (ignored_channels_constr.datalen > 0)
37225                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37226         else
37227                 ignored_channels_constr.data = NULL;
37228         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
37229         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
37230                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
37231                 LDKChannelDetails ignored_channels_conv_16_conv;
37232                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
37233                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
37234                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
37235                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
37236                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
37237         }
37238         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
37239         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
37240         int64_tArray ret_arr = NULL;
37241         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37242         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37243         for (size_t j = 0; j < ret_var.datalen; j++) {
37244                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37245                 *ret_conv_9_copy = ret_var.data[j];
37246                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
37247                 ret_arr_ptr[j] = ret_conv_9_ref;
37248         }
37249         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37250         FREE(ret_var.data);
37251         return ret_arr;
37252 }
37253
37254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
37255         LDKChainMonitor this_arg_conv;
37256         this_arg_conv.inner = untag_ptr(this_arg);
37257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37259         this_arg_conv.is_owned = false;
37260         LDKOutPoint funding_txo_conv;
37261         funding_txo_conv.inner = untag_ptr(funding_txo);
37262         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37263         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37264         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37265         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
37266         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
37267         return tag_ptr(ret_conv, true);
37268 }
37269
37270 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
37271         LDKChainMonitor this_arg_conv;
37272         this_arg_conv.inner = untag_ptr(this_arg);
37273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37275         this_arg_conv.is_owned = false;
37276         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
37277         int64_tArray ret_arr = NULL;
37278         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37279         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37280         for (size_t k = 0; k < ret_var.datalen; k++) {
37281                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
37282                 int64_t ret_conv_10_ref = 0;
37283                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
37284                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
37285                 ret_arr_ptr[k] = ret_conv_10_ref;
37286         }
37287         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37288         FREE(ret_var.data);
37289         return ret_arr;
37290 }
37291
37292 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
37293         LDKChainMonitor this_arg_conv;
37294         this_arg_conv.inner = untag_ptr(this_arg);
37295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37297         this_arg_conv.is_owned = false;
37298         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
37299         int64_tArray ret_arr = NULL;
37300         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37301         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37302         for (size_t p = 0; p < ret_var.datalen; p++) {
37303                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37304                 *ret_conv_41_conv = ret_var.data[p];
37305                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
37306         }
37307         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37308         FREE(ret_var.data);
37309         return ret_arr;
37310 }
37311
37312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
37313         LDKChainMonitor this_arg_conv;
37314         this_arg_conv.inner = untag_ptr(this_arg);
37315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37317         this_arg_conv.is_owned = false;
37318         LDKOutPoint funding_txo_conv;
37319         funding_txo_conv.inner = untag_ptr(funding_txo);
37320         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37321         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37322         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37323         LDKMonitorUpdateId completed_update_id_conv;
37324         completed_update_id_conv.inner = untag_ptr(completed_update_id);
37325         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
37326         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
37327         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
37328         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
37329         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
37330         return tag_ptr(ret_conv, true);
37331 }
37332
37333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
37334         LDKChainMonitor this_arg_conv;
37335         this_arg_conv.inner = untag_ptr(this_arg);
37336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37338         this_arg_conv.is_owned = false;
37339         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
37340         int64_t ret_ref = 0;
37341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37343         return ret_ref;
37344 }
37345
37346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
37347         LDKChainMonitor this_arg_conv;
37348         this_arg_conv.inner = untag_ptr(this_arg);
37349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37351         this_arg_conv.is_owned = false;
37352         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
37353 }
37354
37355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
37356         LDKChainMonitor this_arg_conv;
37357         this_arg_conv.inner = untag_ptr(this_arg);
37358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37360         this_arg_conv.is_owned = false;
37361         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
37362         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
37363         return tag_ptr(ret_ret, true);
37364 }
37365
37366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
37367         LDKChainMonitor this_arg_conv;
37368         this_arg_conv.inner = untag_ptr(this_arg);
37369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37371         this_arg_conv.is_owned = false;
37372         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
37373         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
37374         return tag_ptr(ret_ret, true);
37375 }
37376
37377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
37378         LDKChainMonitor this_arg_conv;
37379         this_arg_conv.inner = untag_ptr(this_arg);
37380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37382         this_arg_conv.is_owned = false;
37383         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
37384         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
37385         return tag_ptr(ret_ret, true);
37386 }
37387
37388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
37389         LDKChainMonitor this_arg_conv;
37390         this_arg_conv.inner = untag_ptr(this_arg);
37391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37393         this_arg_conv.is_owned = false;
37394         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
37395         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
37396         return tag_ptr(ret_ret, true);
37397 }
37398
37399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37400         LDKChannelMonitorUpdate this_obj_conv;
37401         this_obj_conv.inner = untag_ptr(this_obj);
37402         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37404         ChannelMonitorUpdate_free(this_obj_conv);
37405 }
37406
37407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37408         LDKChannelMonitorUpdate this_ptr_conv;
37409         this_ptr_conv.inner = untag_ptr(this_ptr);
37410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37412         this_ptr_conv.is_owned = false;
37413         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
37414         return ret_conv;
37415 }
37416
37417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37418         LDKChannelMonitorUpdate this_ptr_conv;
37419         this_ptr_conv.inner = untag_ptr(this_ptr);
37420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37422         this_ptr_conv.is_owned = false;
37423         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
37424 }
37425
37426 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
37427         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
37428         int64_t ret_ref = 0;
37429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37431         return ret_ref;
37432 }
37433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37434         LDKChannelMonitorUpdate arg_conv;
37435         arg_conv.inner = untag_ptr(arg);
37436         arg_conv.is_owned = ptr_is_owned(arg);
37437         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37438         arg_conv.is_owned = false;
37439         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
37440         return ret_conv;
37441 }
37442
37443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37444         LDKChannelMonitorUpdate orig_conv;
37445         orig_conv.inner = untag_ptr(orig);
37446         orig_conv.is_owned = ptr_is_owned(orig);
37447         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37448         orig_conv.is_owned = false;
37449         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
37450         int64_t ret_ref = 0;
37451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37453         return ret_ref;
37454 }
37455
37456 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37457         LDKChannelMonitorUpdate a_conv;
37458         a_conv.inner = untag_ptr(a);
37459         a_conv.is_owned = ptr_is_owned(a);
37460         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37461         a_conv.is_owned = false;
37462         LDKChannelMonitorUpdate b_conv;
37463         b_conv.inner = untag_ptr(b);
37464         b_conv.is_owned = ptr_is_owned(b);
37465         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37466         b_conv.is_owned = false;
37467         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
37468         return ret_conv;
37469 }
37470
37471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
37472         LDKChannelMonitorUpdate obj_conv;
37473         obj_conv.inner = untag_ptr(obj);
37474         obj_conv.is_owned = ptr_is_owned(obj);
37475         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37476         obj_conv.is_owned = false;
37477         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
37478         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37479         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37480         CVec_u8Z_free(ret_var);
37481         return ret_arr;
37482 }
37483
37484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37485         LDKu8slice ser_ref;
37486         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37487         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37488         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
37489         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
37490         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37491         return tag_ptr(ret_conv, true);
37492 }
37493
37494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37495         if (!ptr_is_owned(this_ptr)) return;
37496         void* this_ptr_ptr = untag_ptr(this_ptr);
37497         CHECK_ACCESS(this_ptr_ptr);
37498         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
37499         FREE(untag_ptr(this_ptr));
37500         MonitorEvent_free(this_ptr_conv);
37501 }
37502
37503 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
37504         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37505         *ret_copy = MonitorEvent_clone(arg);
37506         int64_t ret_ref = tag_ptr(ret_copy, true);
37507         return ret_ref;
37508 }
37509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37510         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
37511         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
37512         return ret_conv;
37513 }
37514
37515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37516         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
37517         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37518         *ret_copy = MonitorEvent_clone(orig_conv);
37519         int64_t ret_ref = tag_ptr(ret_copy, true);
37520         return ret_ref;
37521 }
37522
37523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
37524         LDKHTLCUpdate a_conv;
37525         a_conv.inner = untag_ptr(a);
37526         a_conv.is_owned = ptr_is_owned(a);
37527         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37528         a_conv = HTLCUpdate_clone(&a_conv);
37529         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37530         *ret_copy = MonitorEvent_htlcevent(a_conv);
37531         int64_t ret_ref = tag_ptr(ret_copy, true);
37532         return ret_ref;
37533 }
37534
37535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed(JNIEnv *env, jclass clz, int64_t a) {
37536         LDKOutPoint a_conv;
37537         a_conv.inner = untag_ptr(a);
37538         a_conv.is_owned = ptr_is_owned(a);
37539         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37540         a_conv = OutPoint_clone(&a_conv);
37541         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37542         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
37543         int64_t ret_ref = tag_ptr(ret_copy, true);
37544         return ret_ref;
37545 }
37546
37547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
37548         LDKOutPoint funding_txo_conv;
37549         funding_txo_conv.inner = untag_ptr(funding_txo);
37550         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37551         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37552         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37553         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37554         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
37555         int64_t ret_ref = tag_ptr(ret_copy, true);
37556         return ret_ref;
37557 }
37558
37559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37560         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
37561         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
37562         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
37563         return ret_conv;
37564 }
37565
37566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
37567         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
37568         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
37569         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37570         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37571         CVec_u8Z_free(ret_var);
37572         return ret_arr;
37573 }
37574
37575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37576         LDKu8slice ser_ref;
37577         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37578         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37579         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
37580         *ret_conv = MonitorEvent_read(ser_ref);
37581         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37582         return tag_ptr(ret_conv, true);
37583 }
37584
37585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37586         LDKHTLCUpdate this_obj_conv;
37587         this_obj_conv.inner = untag_ptr(this_obj);
37588         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37590         HTLCUpdate_free(this_obj_conv);
37591 }
37592
37593 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
37594         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
37595         int64_t ret_ref = 0;
37596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37598         return ret_ref;
37599 }
37600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37601         LDKHTLCUpdate arg_conv;
37602         arg_conv.inner = untag_ptr(arg);
37603         arg_conv.is_owned = ptr_is_owned(arg);
37604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37605         arg_conv.is_owned = false;
37606         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
37607         return ret_conv;
37608 }
37609
37610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37611         LDKHTLCUpdate orig_conv;
37612         orig_conv.inner = untag_ptr(orig);
37613         orig_conv.is_owned = ptr_is_owned(orig);
37614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37615         orig_conv.is_owned = false;
37616         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
37617         int64_t ret_ref = 0;
37618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37620         return ret_ref;
37621 }
37622
37623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37624         LDKHTLCUpdate a_conv;
37625         a_conv.inner = untag_ptr(a);
37626         a_conv.is_owned = ptr_is_owned(a);
37627         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37628         a_conv.is_owned = false;
37629         LDKHTLCUpdate b_conv;
37630         b_conv.inner = untag_ptr(b);
37631         b_conv.is_owned = ptr_is_owned(b);
37632         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37633         b_conv.is_owned = false;
37634         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
37635         return ret_conv;
37636 }
37637
37638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
37639         LDKHTLCUpdate obj_conv;
37640         obj_conv.inner = untag_ptr(obj);
37641         obj_conv.is_owned = ptr_is_owned(obj);
37642         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37643         obj_conv.is_owned = false;
37644         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
37645         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37646         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37647         CVec_u8Z_free(ret_var);
37648         return ret_arr;
37649 }
37650
37651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37652         LDKu8slice ser_ref;
37653         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37654         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37655         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
37656         *ret_conv = HTLCUpdate_read(ser_ref);
37657         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37658         return tag_ptr(ret_conv, true);
37659 }
37660
37661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37662         if (!ptr_is_owned(this_ptr)) return;
37663         void* this_ptr_ptr = untag_ptr(this_ptr);
37664         CHECK_ACCESS(this_ptr_ptr);
37665         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
37666         FREE(untag_ptr(this_ptr));
37667         Balance_free(this_ptr_conv);
37668 }
37669
37670 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
37671         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37672         *ret_copy = Balance_clone(arg);
37673         int64_t ret_ref = tag_ptr(ret_copy, true);
37674         return ret_ref;
37675 }
37676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37677         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
37678         int64_t ret_conv = Balance_clone_ptr(arg_conv);
37679         return ret_conv;
37680 }
37681
37682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37683         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
37684         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37685         *ret_copy = Balance_clone(orig_conv);
37686         int64_t ret_ref = tag_ptr(ret_copy, true);
37687         return ret_ref;
37688 }
37689
37690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
37691         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37692         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
37693         int64_t ret_ref = tag_ptr(ret_copy, true);
37694         return ret_ref;
37695 }
37696
37697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t confirmation_height) {
37698         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37699         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
37700         int64_t ret_ref = tag_ptr(ret_copy, true);
37701         return ret_ref;
37702 }
37703
37704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t timeout_height, int8_tArray payment_hash, int8_tArray payment_preimage) {
37705         LDKThirtyTwoBytes payment_hash_ref;
37706         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37707         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37708         LDKThirtyTwoBytes payment_preimage_ref;
37709         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
37710         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
37711         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37712         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
37713         int64_t ret_ref = tag_ptr(ret_copy, true);
37714         return ret_ref;
37715 }
37716
37717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1timeout_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t claimable_height, int8_tArray payment_hash) {
37718         LDKThirtyTwoBytes payment_hash_ref;
37719         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37720         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37721         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37722         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
37723         int64_t ret_ref = tag_ptr(ret_copy, true);
37724         return ret_ref;
37725 }
37726
37727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1preimage_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t expiry_height, int8_tArray payment_hash) {
37728         LDKThirtyTwoBytes payment_hash_ref;
37729         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37730         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37731         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37732         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
37733         int64_t ret_ref = tag_ptr(ret_copy, true);
37734         return ret_ref;
37735 }
37736
37737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
37738         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37739         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
37740         int64_t ret_ref = tag_ptr(ret_copy, true);
37741         return ret_ref;
37742 }
37743
37744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37745         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
37746         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
37747         jboolean ret_conv = Balance_eq(a_conv, b_conv);
37748         return ret_conv;
37749 }
37750
37751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
37752         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
37753         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
37754         return ret_conv;
37755 }
37756
37757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37758         LDKChannelMonitor this_obj_conv;
37759         this_obj_conv.inner = untag_ptr(this_obj);
37760         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37762         ChannelMonitor_free(this_obj_conv);
37763 }
37764
37765 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
37766         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
37767         int64_t ret_ref = 0;
37768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37770         return ret_ref;
37771 }
37772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37773         LDKChannelMonitor arg_conv;
37774         arg_conv.inner = untag_ptr(arg);
37775         arg_conv.is_owned = ptr_is_owned(arg);
37776         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37777         arg_conv.is_owned = false;
37778         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
37779         return ret_conv;
37780 }
37781
37782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37783         LDKChannelMonitor orig_conv;
37784         orig_conv.inner = untag_ptr(orig);
37785         orig_conv.is_owned = ptr_is_owned(orig);
37786         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37787         orig_conv.is_owned = false;
37788         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
37789         int64_t ret_ref = 0;
37790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37792         return ret_ref;
37793 }
37794
37795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
37796         LDKChannelMonitor obj_conv;
37797         obj_conv.inner = untag_ptr(obj);
37798         obj_conv.is_owned = ptr_is_owned(obj);
37799         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37800         obj_conv.is_owned = false;
37801         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
37802         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37803         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37804         CVec_u8Z_free(ret_var);
37805         return ret_arr;
37806 }
37807
37808 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) {
37809         LDKChannelMonitor this_arg_conv;
37810         this_arg_conv.inner = untag_ptr(this_arg);
37811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37813         this_arg_conv.is_owned = false;
37814         LDKChannelMonitorUpdate updates_conv;
37815         updates_conv.inner = untag_ptr(updates);
37816         updates_conv.is_owned = ptr_is_owned(updates);
37817         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
37818         updates_conv.is_owned = false;
37819         void* broadcaster_ptr = untag_ptr(broadcaster);
37820         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
37821         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
37822         void* fee_estimator_ptr = untag_ptr(fee_estimator);
37823         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
37824         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
37825         void* logger_ptr = untag_ptr(logger);
37826         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
37827         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
37828         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37829         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
37830         return tag_ptr(ret_conv, true);
37831 }
37832
37833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
37834         LDKChannelMonitor this_arg_conv;
37835         this_arg_conv.inner = untag_ptr(this_arg);
37836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37838         this_arg_conv.is_owned = false;
37839         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
37840         return ret_conv;
37841 }
37842
37843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
37844         LDKChannelMonitor this_arg_conv;
37845         this_arg_conv.inner = untag_ptr(this_arg);
37846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37848         this_arg_conv.is_owned = false;
37849         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
37850         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
37851         return tag_ptr(ret_conv, true);
37852 }
37853
37854 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
37855         LDKChannelMonitor this_arg_conv;
37856         this_arg_conv.inner = untag_ptr(this_arg);
37857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37859         this_arg_conv.is_owned = false;
37860         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
37861         int64_tArray ret_arr = NULL;
37862         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37863         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37864         for (size_t a = 0; a < ret_var.datalen; a++) {
37865                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
37866                 *ret_conv_52_conv = ret_var.data[a];
37867                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
37868         }
37869         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37870         FREE(ret_var.data);
37871         return ret_arr;
37872 }
37873
37874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
37875         LDKChannelMonitor this_arg_conv;
37876         this_arg_conv.inner = untag_ptr(this_arg);
37877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37879         this_arg_conv.is_owned = false;
37880         void* filter_ptr = untag_ptr(filter);
37881         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
37882         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
37883         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
37884 }
37885
37886 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
37887         LDKChannelMonitor this_arg_conv;
37888         this_arg_conv.inner = untag_ptr(this_arg);
37889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37891         this_arg_conv.is_owned = false;
37892         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
37893         int64_tArray ret_arr = NULL;
37894         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37895         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37896         for (size_t o = 0; o < ret_var.datalen; o++) {
37897                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
37898                 *ret_conv_14_copy = ret_var.data[o];
37899                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
37900                 ret_arr_ptr[o] = ret_conv_14_ref;
37901         }
37902         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37903         FREE(ret_var.data);
37904         return ret_arr;
37905 }
37906
37907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
37908         LDKChannelMonitor this_arg_conv;
37909         this_arg_conv.inner = untag_ptr(this_arg);
37910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37912         this_arg_conv.is_owned = false;
37913         void* handler_ptr = untag_ptr(handler);
37914         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
37915         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
37916         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
37917 }
37918
37919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1initial_1counterparty_1commitment_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
37920         LDKChannelMonitor this_arg_conv;
37921         this_arg_conv.inner = untag_ptr(this_arg);
37922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37924         this_arg_conv.is_owned = false;
37925         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
37926         int64_t ret_ref = 0;
37927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37929         return ret_ref;
37930 }
37931
37932 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1counterparty_1commitment_1txs_1from_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
37933         LDKChannelMonitor this_arg_conv;
37934         this_arg_conv.inner = untag_ptr(this_arg);
37935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37937         this_arg_conv.is_owned = false;
37938         LDKChannelMonitorUpdate update_conv;
37939         update_conv.inner = untag_ptr(update);
37940         update_conv.is_owned = ptr_is_owned(update);
37941         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
37942         update_conv.is_owned = false;
37943         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
37944         int64_tArray ret_arr = NULL;
37945         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37946         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37947         for (size_t x = 0; x < ret_var.datalen; x++) {
37948                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
37949                 int64_t ret_conv_23_ref = 0;
37950                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
37951                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
37952                 ret_arr_ptr[x] = ret_conv_23_ref;
37953         }
37954         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37955         FREE(ret_var.data);
37956         return ret_arr;
37957 }
37958
37959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1sign_1to_1local_1justice_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input_idx, int64_t value, int64_t commitment_number) {
37960         LDKChannelMonitor this_arg_conv;
37961         this_arg_conv.inner = untag_ptr(this_arg);
37962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37964         this_arg_conv.is_owned = false;
37965         LDKTransaction justice_tx_ref;
37966         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
37967         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
37968         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
37969         justice_tx_ref.data_is_owned = true;
37970         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
37971         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
37972         return tag_ptr(ret_conv, true);
37973 }
37974
37975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
37976         LDKChannelMonitor this_arg_conv;
37977         this_arg_conv.inner = untag_ptr(this_arg);
37978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37980         this_arg_conv.is_owned = false;
37981         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37982         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
37983         return ret_arr;
37984 }
37985
37986 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) {
37987         LDKChannelMonitor this_arg_conv;
37988         this_arg_conv.inner = untag_ptr(this_arg);
37989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37991         this_arg_conv.is_owned = false;
37992         void* logger_ptr = untag_ptr(logger);
37993         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
37994         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
37995         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
37996         jobjectArray ret_arr = NULL;
37997         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
37998         ;
37999         for (size_t i = 0; i < ret_var.datalen; i++) {
38000                 LDKTransaction ret_conv_8_var = ret_var.data[i];
38001                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
38002                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
38003                 Transaction_free(ret_conv_8_var);
38004                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38005         }
38006         
38007         FREE(ret_var.data);
38008         return ret_arr;
38009 }
38010
38011 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) {
38012         LDKChannelMonitor this_arg_conv;
38013         this_arg_conv.inner = untag_ptr(this_arg);
38014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38016         this_arg_conv.is_owned = false;
38017         uint8_t header_arr[80];
38018         CHECK((*env)->GetArrayLength(env, header) == 80);
38019         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38020         uint8_t (*header_ref)[80] = &header_arr;
38021         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
38022         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
38023         if (txdata_constr.datalen > 0)
38024                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
38025         else
38026                 txdata_constr.data = NULL;
38027         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
38028         for (size_t c = 0; c < txdata_constr.datalen; c++) {
38029                 int64_t txdata_conv_28 = txdata_vals[c];
38030                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
38031                 CHECK_ACCESS(txdata_conv_28_ptr);
38032                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
38033                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
38034                 txdata_constr.data[c] = txdata_conv_28_conv;
38035         }
38036         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
38037         void* broadcaster_ptr = untag_ptr(broadcaster);
38038         CHECK_ACCESS(broadcaster_ptr);
38039         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38040         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38041                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38042                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38043         }
38044         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38045         CHECK_ACCESS(fee_estimator_ptr);
38046         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38047         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38048                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38049                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38050         }
38051         void* logger_ptr = untag_ptr(logger);
38052         CHECK_ACCESS(logger_ptr);
38053         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38054         if (logger_conv.free == LDKLogger_JCalls_free) {
38055                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38056                 LDKLogger_JCalls_cloned(&logger_conv);
38057         }
38058         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38059         int64_tArray ret_arr = NULL;
38060         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38061         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38062         for (size_t x = 0; x < ret_var.datalen; x++) {
38063                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38064                 *ret_conv_49_conv = ret_var.data[x];
38065                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38066         }
38067         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38068         FREE(ret_var.data);
38069         return ret_arr;
38070 }
38071
38072 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) {
38073         LDKChannelMonitor this_arg_conv;
38074         this_arg_conv.inner = untag_ptr(this_arg);
38075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38077         this_arg_conv.is_owned = false;
38078         uint8_t header_arr[80];
38079         CHECK((*env)->GetArrayLength(env, header) == 80);
38080         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38081         uint8_t (*header_ref)[80] = &header_arr;
38082         void* broadcaster_ptr = untag_ptr(broadcaster);
38083         CHECK_ACCESS(broadcaster_ptr);
38084         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38085         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38086                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38087                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38088         }
38089         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38090         CHECK_ACCESS(fee_estimator_ptr);
38091         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38092         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38093                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38094                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38095         }
38096         void* logger_ptr = untag_ptr(logger);
38097         CHECK_ACCESS(logger_ptr);
38098         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38099         if (logger_conv.free == LDKLogger_JCalls_free) {
38100                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38101                 LDKLogger_JCalls_cloned(&logger_conv);
38102         }
38103         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38104 }
38105
38106 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transactions_1confirmed(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) {
38107         LDKChannelMonitor this_arg_conv;
38108         this_arg_conv.inner = untag_ptr(this_arg);
38109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38111         this_arg_conv.is_owned = false;
38112         uint8_t header_arr[80];
38113         CHECK((*env)->GetArrayLength(env, header) == 80);
38114         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38115         uint8_t (*header_ref)[80] = &header_arr;
38116         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
38117         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
38118         if (txdata_constr.datalen > 0)
38119                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
38120         else
38121                 txdata_constr.data = NULL;
38122         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
38123         for (size_t c = 0; c < txdata_constr.datalen; c++) {
38124                 int64_t txdata_conv_28 = txdata_vals[c];
38125                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
38126                 CHECK_ACCESS(txdata_conv_28_ptr);
38127                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
38128                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
38129                 txdata_constr.data[c] = txdata_conv_28_conv;
38130         }
38131         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
38132         void* broadcaster_ptr = untag_ptr(broadcaster);
38133         CHECK_ACCESS(broadcaster_ptr);
38134         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38135         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38136                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38137                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38138         }
38139         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38140         CHECK_ACCESS(fee_estimator_ptr);
38141         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38142         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38143                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38144                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38145         }
38146         void* logger_ptr = untag_ptr(logger);
38147         CHECK_ACCESS(logger_ptr);
38148         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38149         if (logger_conv.free == LDKLogger_JCalls_free) {
38150                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38151                 LDKLogger_JCalls_cloned(&logger_conv);
38152         }
38153         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38154         int64_tArray ret_arr = NULL;
38155         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38156         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38157         for (size_t x = 0; x < ret_var.datalen; x++) {
38158                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38159                 *ret_conv_49_conv = ret_var.data[x];
38160                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38161         }
38162         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38163         FREE(ret_var.data);
38164         return ret_arr;
38165 }
38166
38167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
38168         LDKChannelMonitor this_arg_conv;
38169         this_arg_conv.inner = untag_ptr(this_arg);
38170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38172         this_arg_conv.is_owned = false;
38173         uint8_t txid_arr[32];
38174         CHECK((*env)->GetArrayLength(env, txid) == 32);
38175         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
38176         uint8_t (*txid_ref)[32] = &txid_arr;
38177         void* broadcaster_ptr = untag_ptr(broadcaster);
38178         CHECK_ACCESS(broadcaster_ptr);
38179         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38180         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38181                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38182                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38183         }
38184         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38185         CHECK_ACCESS(fee_estimator_ptr);
38186         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38187         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38188                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38189                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38190         }
38191         void* logger_ptr = untag_ptr(logger);
38192         CHECK_ACCESS(logger_ptr);
38193         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38194         if (logger_conv.free == LDKLogger_JCalls_free) {
38195                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38196                 LDKLogger_JCalls_cloned(&logger_conv);
38197         }
38198         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
38199 }
38200
38201 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
38202         LDKChannelMonitor this_arg_conv;
38203         this_arg_conv.inner = untag_ptr(this_arg);
38204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38206         this_arg_conv.is_owned = false;
38207         uint8_t header_arr[80];
38208         CHECK((*env)->GetArrayLength(env, header) == 80);
38209         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38210         uint8_t (*header_ref)[80] = &header_arr;
38211         void* broadcaster_ptr = untag_ptr(broadcaster);
38212         CHECK_ACCESS(broadcaster_ptr);
38213         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38214         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38215                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38216                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38217         }
38218         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38219         CHECK_ACCESS(fee_estimator_ptr);
38220         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38221         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38222                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38223                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38224         }
38225         void* logger_ptr = untag_ptr(logger);
38226         CHECK_ACCESS(logger_ptr);
38227         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38228         if (logger_conv.free == LDKLogger_JCalls_free) {
38229                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38230                 LDKLogger_JCalls_cloned(&logger_conv);
38231         }
38232         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38233         int64_tArray ret_arr = NULL;
38234         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38235         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38236         for (size_t x = 0; x < ret_var.datalen; x++) {
38237                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38238                 *ret_conv_49_conv = ret_var.data[x];
38239                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38240         }
38241         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38242         FREE(ret_var.data);
38243         return ret_arr;
38244 }
38245
38246 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
38247         LDKChannelMonitor this_arg_conv;
38248         this_arg_conv.inner = untag_ptr(this_arg);
38249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38251         this_arg_conv.is_owned = false;
38252         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
38253         int64_tArray ret_arr = NULL;
38254         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38255         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38256         for (size_t x = 0; x < ret_var.datalen; x++) {
38257                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
38258                 *ret_conv_49_conv = ret_var.data[x];
38259                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38260         }
38261         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38262         FREE(ret_var.data);
38263         return ret_arr;
38264 }
38265
38266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
38267         LDKChannelMonitor this_arg_conv;
38268         this_arg_conv.inner = untag_ptr(this_arg);
38269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38271         this_arg_conv.is_owned = false;
38272         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
38273         int64_t ret_ref = 0;
38274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38276         return ret_ref;
38277 }
38278
38279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
38280         LDKChannelMonitor this_arg_conv;
38281         this_arg_conv.inner = untag_ptr(this_arg);
38282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38284         this_arg_conv.is_owned = false;
38285         void* broadcaster_ptr = untag_ptr(broadcaster);
38286         CHECK_ACCESS(broadcaster_ptr);
38287         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38288         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38289                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38290                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38291         }
38292         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38293         CHECK_ACCESS(fee_estimator_ptr);
38294         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38295         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38296                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38297                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38298         }
38299         void* logger_ptr = untag_ptr(logger);
38300         CHECK_ACCESS(logger_ptr);
38301         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38302         if (logger_conv.free == LDKLogger_JCalls_free) {
38303                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38304                 LDKLogger_JCalls_cloned(&logger_conv);
38305         }
38306         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
38307 }
38308
38309 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx, int32_t confirmation_height) {
38310         LDKChannelMonitor this_arg_conv;
38311         this_arg_conv.inner = untag_ptr(this_arg);
38312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38314         this_arg_conv.is_owned = false;
38315         LDKTransaction tx_ref;
38316         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
38317         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
38318         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
38319         tx_ref.data_is_owned = true;
38320         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
38321         int64_tArray ret_arr = NULL;
38322         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38323         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38324         for (size_t b = 0; b < ret_var.datalen; b++) {
38325                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
38326                 *ret_conv_27_copy = ret_var.data[b];
38327                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
38328                 ret_arr_ptr[b] = ret_conv_27_ref;
38329         }
38330         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38331         FREE(ret_var.data);
38332         return ret_arr;
38333 }
38334
38335 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
38336         LDKChannelMonitor this_arg_conv;
38337         this_arg_conv.inner = untag_ptr(this_arg);
38338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38340         this_arg_conv.is_owned = false;
38341         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
38342         int64_tArray ret_arr = NULL;
38343         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38344         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38345         for (size_t j = 0; j < ret_var.datalen; j++) {
38346                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38347                 *ret_conv_9_copy = ret_var.data[j];
38348                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
38349                 ret_arr_ptr[j] = ret_conv_9_ref;
38350         }
38351         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38352         FREE(ret_var.data);
38353         return ret_arr;
38354 }
38355
38356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) {
38357         LDKu8slice ser_ref;
38358         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38359         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38360         void* arg_a_ptr = untag_ptr(arg_a);
38361         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
38362         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
38363         void* arg_b_ptr = untag_ptr(arg_b);
38364         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
38365         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
38366         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
38367         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
38368         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38369         return tag_ptr(ret_conv, true);
38370 }
38371
38372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38373         LDKOutPoint this_obj_conv;
38374         this_obj_conv.inner = untag_ptr(this_obj);
38375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38377         OutPoint_free(this_obj_conv);
38378 }
38379
38380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
38381         LDKOutPoint this_ptr_conv;
38382         this_ptr_conv.inner = untag_ptr(this_ptr);
38383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38385         this_ptr_conv.is_owned = false;
38386         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38387         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
38388         return ret_arr;
38389 }
38390
38391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38392         LDKOutPoint this_ptr_conv;
38393         this_ptr_conv.inner = untag_ptr(this_ptr);
38394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38396         this_ptr_conv.is_owned = false;
38397         LDKThirtyTwoBytes val_ref;
38398         CHECK((*env)->GetArrayLength(env, val) == 32);
38399         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38400         OutPoint_set_txid(&this_ptr_conv, val_ref);
38401 }
38402
38403 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
38404         LDKOutPoint this_ptr_conv;
38405         this_ptr_conv.inner = untag_ptr(this_ptr);
38406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38408         this_ptr_conv.is_owned = false;
38409         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
38410         return ret_conv;
38411 }
38412
38413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38414         LDKOutPoint this_ptr_conv;
38415         this_ptr_conv.inner = untag_ptr(this_ptr);
38416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38418         this_ptr_conv.is_owned = false;
38419         OutPoint_set_index(&this_ptr_conv, val);
38420 }
38421
38422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
38423         LDKThirtyTwoBytes txid_arg_ref;
38424         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
38425         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
38426         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
38427         int64_t ret_ref = 0;
38428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38430         return ret_ref;
38431 }
38432
38433 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
38434         LDKOutPoint ret_var = OutPoint_clone(arg);
38435         int64_t ret_ref = 0;
38436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38438         return ret_ref;
38439 }
38440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38441         LDKOutPoint arg_conv;
38442         arg_conv.inner = untag_ptr(arg);
38443         arg_conv.is_owned = ptr_is_owned(arg);
38444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38445         arg_conv.is_owned = false;
38446         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
38447         return ret_conv;
38448 }
38449
38450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38451         LDKOutPoint orig_conv;
38452         orig_conv.inner = untag_ptr(orig);
38453         orig_conv.is_owned = ptr_is_owned(orig);
38454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38455         orig_conv.is_owned = false;
38456         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
38457         int64_t ret_ref = 0;
38458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38460         return ret_ref;
38461 }
38462
38463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38464         LDKOutPoint a_conv;
38465         a_conv.inner = untag_ptr(a);
38466         a_conv.is_owned = ptr_is_owned(a);
38467         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38468         a_conv.is_owned = false;
38469         LDKOutPoint b_conv;
38470         b_conv.inner = untag_ptr(b);
38471         b_conv.is_owned = ptr_is_owned(b);
38472         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38473         b_conv.is_owned = false;
38474         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
38475         return ret_conv;
38476 }
38477
38478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
38479         LDKOutPoint o_conv;
38480         o_conv.inner = untag_ptr(o);
38481         o_conv.is_owned = ptr_is_owned(o);
38482         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38483         o_conv.is_owned = false;
38484         int64_t ret_conv = OutPoint_hash(&o_conv);
38485         return ret_conv;
38486 }
38487
38488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
38489         LDKOutPoint this_arg_conv;
38490         this_arg_conv.inner = untag_ptr(this_arg);
38491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38493         this_arg_conv.is_owned = false;
38494         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38495         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
38496         return ret_arr;
38497 }
38498
38499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
38500         LDKOutPoint obj_conv;
38501         obj_conv.inner = untag_ptr(obj);
38502         obj_conv.is_owned = ptr_is_owned(obj);
38503         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38504         obj_conv.is_owned = false;
38505         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
38506         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38507         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38508         CVec_u8Z_free(ret_var);
38509         return ret_arr;
38510 }
38511
38512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38513         LDKu8slice ser_ref;
38514         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38515         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38516         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38517         *ret_conv = OutPoint_read(ser_ref);
38518         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38519         return tag_ptr(ret_conv, true);
38520 }
38521
38522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FailureCode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38523         if (!ptr_is_owned(this_ptr)) return;
38524         void* this_ptr_ptr = untag_ptr(this_ptr);
38525         CHECK_ACCESS(this_ptr_ptr);
38526         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
38527         FREE(untag_ptr(this_ptr));
38528         FailureCode_free(this_ptr_conv);
38529 }
38530
38531 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
38532         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38533         *ret_copy = FailureCode_clone(arg);
38534         int64_t ret_ref = tag_ptr(ret_copy, true);
38535         return ret_ref;
38536 }
38537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38538         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
38539         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
38540         return ret_conv;
38541 }
38542
38543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38544         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
38545         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38546         *ret_copy = FailureCode_clone(orig_conv);
38547         int64_t ret_ref = tag_ptr(ret_copy, true);
38548         return ret_ref;
38549 }
38550
38551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
38552         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38553         *ret_copy = FailureCode_temporary_node_failure();
38554         int64_t ret_ref = tag_ptr(ret_copy, true);
38555         return ret_ref;
38556 }
38557
38558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
38559         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38560         *ret_copy = FailureCode_required_node_feature_missing();
38561         int64_t ret_ref = tag_ptr(ret_copy, true);
38562         return ret_ref;
38563 }
38564
38565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
38566         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38567         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
38568         int64_t ret_ref = tag_ptr(ret_copy, true);
38569         return ret_ref;
38570 }
38571
38572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1invalid_1onion_1payload(JNIEnv *env, jclass clz, int64_t a) {
38573         void* a_ptr = untag_ptr(a);
38574         CHECK_ACCESS(a_ptr);
38575         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
38576         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
38577         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
38578         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
38579         int64_t ret_ref = tag_ptr(ret_copy, true);
38580         return ret_ref;
38581 }
38582
38583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38584         LDKChannelManager this_obj_conv;
38585         this_obj_conv.inner = untag_ptr(this_obj);
38586         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38588         ChannelManager_free(this_obj_conv);
38589 }
38590
38591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38592         LDKChainParameters this_obj_conv;
38593         this_obj_conv.inner = untag_ptr(this_obj);
38594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38596         ChainParameters_free(this_obj_conv);
38597 }
38598
38599 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
38600         LDKChainParameters this_ptr_conv;
38601         this_ptr_conv.inner = untag_ptr(this_ptr);
38602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38604         this_ptr_conv.is_owned = false;
38605         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
38606         return ret_conv;
38607 }
38608
38609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
38610         LDKChainParameters this_ptr_conv;
38611         this_ptr_conv.inner = untag_ptr(this_ptr);
38612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38614         this_ptr_conv.is_owned = false;
38615         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
38616         ChainParameters_set_network(&this_ptr_conv, val_conv);
38617 }
38618
38619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
38620         LDKChainParameters this_ptr_conv;
38621         this_ptr_conv.inner = untag_ptr(this_ptr);
38622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38624         this_ptr_conv.is_owned = false;
38625         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
38626         int64_t ret_ref = 0;
38627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38629         return ret_ref;
38630 }
38631
38632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38633         LDKChainParameters this_ptr_conv;
38634         this_ptr_conv.inner = untag_ptr(this_ptr);
38635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38637         this_ptr_conv.is_owned = false;
38638         LDKBestBlock val_conv;
38639         val_conv.inner = untag_ptr(val);
38640         val_conv.is_owned = ptr_is_owned(val);
38641         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38642         val_conv = BestBlock_clone(&val_conv);
38643         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
38644 }
38645
38646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
38647         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
38648         LDKBestBlock best_block_arg_conv;
38649         best_block_arg_conv.inner = untag_ptr(best_block_arg);
38650         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
38651         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
38652         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
38653         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
38654         int64_t ret_ref = 0;
38655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38657         return ret_ref;
38658 }
38659
38660 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
38661         LDKChainParameters ret_var = ChainParameters_clone(arg);
38662         int64_t ret_ref = 0;
38663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38665         return ret_ref;
38666 }
38667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38668         LDKChainParameters arg_conv;
38669         arg_conv.inner = untag_ptr(arg);
38670         arg_conv.is_owned = ptr_is_owned(arg);
38671         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38672         arg_conv.is_owned = false;
38673         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
38674         return ret_conv;
38675 }
38676
38677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38678         LDKChainParameters orig_conv;
38679         orig_conv.inner = untag_ptr(orig);
38680         orig_conv.is_owned = ptr_is_owned(orig);
38681         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38682         orig_conv.is_owned = false;
38683         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
38684         int64_t ret_ref = 0;
38685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38687         return ret_ref;
38688 }
38689
38690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38691         LDKCounterpartyForwardingInfo this_obj_conv;
38692         this_obj_conv.inner = untag_ptr(this_obj);
38693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38695         CounterpartyForwardingInfo_free(this_obj_conv);
38696 }
38697
38698 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38699         LDKCounterpartyForwardingInfo this_ptr_conv;
38700         this_ptr_conv.inner = untag_ptr(this_ptr);
38701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38703         this_ptr_conv.is_owned = false;
38704         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
38705         return ret_conv;
38706 }
38707
38708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38709         LDKCounterpartyForwardingInfo this_ptr_conv;
38710         this_ptr_conv.inner = untag_ptr(this_ptr);
38711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38713         this_ptr_conv.is_owned = false;
38714         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
38715 }
38716
38717 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
38718         LDKCounterpartyForwardingInfo this_ptr_conv;
38719         this_ptr_conv.inner = untag_ptr(this_ptr);
38720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38722         this_ptr_conv.is_owned = false;
38723         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
38724         return ret_conv;
38725 }
38726
38727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38728         LDKCounterpartyForwardingInfo this_ptr_conv;
38729         this_ptr_conv.inner = untag_ptr(this_ptr);
38730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38732         this_ptr_conv.is_owned = false;
38733         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
38734 }
38735
38736 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
38737         LDKCounterpartyForwardingInfo this_ptr_conv;
38738         this_ptr_conv.inner = untag_ptr(this_ptr);
38739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38741         this_ptr_conv.is_owned = false;
38742         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
38743         return ret_conv;
38744 }
38745
38746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38747         LDKCounterpartyForwardingInfo this_ptr_conv;
38748         this_ptr_conv.inner = untag_ptr(this_ptr);
38749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38751         this_ptr_conv.is_owned = false;
38752         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
38753 }
38754
38755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
38756         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
38757         int64_t ret_ref = 0;
38758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38760         return ret_ref;
38761 }
38762
38763 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
38764         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
38765         int64_t ret_ref = 0;
38766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38768         return ret_ref;
38769 }
38770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38771         LDKCounterpartyForwardingInfo arg_conv;
38772         arg_conv.inner = untag_ptr(arg);
38773         arg_conv.is_owned = ptr_is_owned(arg);
38774         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38775         arg_conv.is_owned = false;
38776         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
38777         return ret_conv;
38778 }
38779
38780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38781         LDKCounterpartyForwardingInfo orig_conv;
38782         orig_conv.inner = untag_ptr(orig);
38783         orig_conv.is_owned = ptr_is_owned(orig);
38784         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38785         orig_conv.is_owned = false;
38786         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
38787         int64_t ret_ref = 0;
38788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38790         return ret_ref;
38791 }
38792
38793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38794         LDKChannelCounterparty this_obj_conv;
38795         this_obj_conv.inner = untag_ptr(this_obj);
38796         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38798         ChannelCounterparty_free(this_obj_conv);
38799 }
38800
38801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38802         LDKChannelCounterparty this_ptr_conv;
38803         this_ptr_conv.inner = untag_ptr(this_ptr);
38804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38806         this_ptr_conv.is_owned = false;
38807         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38808         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
38809         return ret_arr;
38810 }
38811
38812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38813         LDKChannelCounterparty this_ptr_conv;
38814         this_ptr_conv.inner = untag_ptr(this_ptr);
38815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38817         this_ptr_conv.is_owned = false;
38818         LDKPublicKey val_ref;
38819         CHECK((*env)->GetArrayLength(env, val) == 33);
38820         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38821         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
38822 }
38823
38824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
38825         LDKChannelCounterparty this_ptr_conv;
38826         this_ptr_conv.inner = untag_ptr(this_ptr);
38827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38829         this_ptr_conv.is_owned = false;
38830         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
38831         int64_t ret_ref = 0;
38832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38834         return ret_ref;
38835 }
38836
38837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38838         LDKChannelCounterparty this_ptr_conv;
38839         this_ptr_conv.inner = untag_ptr(this_ptr);
38840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38842         this_ptr_conv.is_owned = false;
38843         LDKInitFeatures val_conv;
38844         val_conv.inner = untag_ptr(val);
38845         val_conv.is_owned = ptr_is_owned(val);
38846         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38847         val_conv = InitFeatures_clone(&val_conv);
38848         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
38849 }
38850
38851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
38852         LDKChannelCounterparty this_ptr_conv;
38853         this_ptr_conv.inner = untag_ptr(this_ptr);
38854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38856         this_ptr_conv.is_owned = false;
38857         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
38858         return ret_conv;
38859 }
38860
38861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38862         LDKChannelCounterparty this_ptr_conv;
38863         this_ptr_conv.inner = untag_ptr(this_ptr);
38864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38866         this_ptr_conv.is_owned = false;
38867         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
38868 }
38869
38870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
38871         LDKChannelCounterparty this_ptr_conv;
38872         this_ptr_conv.inner = untag_ptr(this_ptr);
38873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38875         this_ptr_conv.is_owned = false;
38876         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
38877         int64_t ret_ref = 0;
38878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38880         return ret_ref;
38881 }
38882
38883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38884         LDKChannelCounterparty this_ptr_conv;
38885         this_ptr_conv.inner = untag_ptr(this_ptr);
38886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38888         this_ptr_conv.is_owned = false;
38889         LDKCounterpartyForwardingInfo val_conv;
38890         val_conv.inner = untag_ptr(val);
38891         val_conv.is_owned = ptr_is_owned(val);
38892         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38893         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
38894         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
38895 }
38896
38897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38898         LDKChannelCounterparty this_ptr_conv;
38899         this_ptr_conv.inner = untag_ptr(this_ptr);
38900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38902         this_ptr_conv.is_owned = false;
38903         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38904         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
38905         int64_t ret_ref = tag_ptr(ret_copy, true);
38906         return ret_ref;
38907 }
38908
38909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38910         LDKChannelCounterparty this_ptr_conv;
38911         this_ptr_conv.inner = untag_ptr(this_ptr);
38912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38914         this_ptr_conv.is_owned = false;
38915         void* val_ptr = untag_ptr(val);
38916         CHECK_ACCESS(val_ptr);
38917         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38918         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38919         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
38920 }
38921
38922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38923         LDKChannelCounterparty this_ptr_conv;
38924         this_ptr_conv.inner = untag_ptr(this_ptr);
38925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38927         this_ptr_conv.is_owned = false;
38928         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38929         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
38930         int64_t ret_ref = tag_ptr(ret_copy, true);
38931         return ret_ref;
38932 }
38933
38934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38935         LDKChannelCounterparty this_ptr_conv;
38936         this_ptr_conv.inner = untag_ptr(this_ptr);
38937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38939         this_ptr_conv.is_owned = false;
38940         void* val_ptr = untag_ptr(val);
38941         CHECK_ACCESS(val_ptr);
38942         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38943         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38944         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
38945 }
38946
38947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JNIEnv *env, jclass clz, int8_tArray node_id_arg, int64_t features_arg, int64_t unspendable_punishment_reserve_arg, int64_t forwarding_info_arg, int64_t outbound_htlc_minimum_msat_arg, int64_t outbound_htlc_maximum_msat_arg) {
38948         LDKPublicKey node_id_arg_ref;
38949         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
38950         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
38951         LDKInitFeatures features_arg_conv;
38952         features_arg_conv.inner = untag_ptr(features_arg);
38953         features_arg_conv.is_owned = ptr_is_owned(features_arg);
38954         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
38955         features_arg_conv = InitFeatures_clone(&features_arg_conv);
38956         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
38957         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
38958         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
38959         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
38960         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
38961         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
38962         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
38963         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
38964         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
38965         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
38966         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
38967         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
38968         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
38969         LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv, outbound_htlc_minimum_msat_arg_conv, outbound_htlc_maximum_msat_arg_conv);
38970         int64_t ret_ref = 0;
38971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38973         return ret_ref;
38974 }
38975
38976 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
38977         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
38978         int64_t ret_ref = 0;
38979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38981         return ret_ref;
38982 }
38983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38984         LDKChannelCounterparty arg_conv;
38985         arg_conv.inner = untag_ptr(arg);
38986         arg_conv.is_owned = ptr_is_owned(arg);
38987         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38988         arg_conv.is_owned = false;
38989         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
38990         return ret_conv;
38991 }
38992
38993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38994         LDKChannelCounterparty orig_conv;
38995         orig_conv.inner = untag_ptr(orig);
38996         orig_conv.is_owned = ptr_is_owned(orig);
38997         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38998         orig_conv.is_owned = false;
38999         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
39000         int64_t ret_ref = 0;
39001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39003         return ret_ref;
39004 }
39005
39006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39007         LDKChannelDetails this_obj_conv;
39008         this_obj_conv.inner = untag_ptr(this_obj);
39009         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39011         ChannelDetails_free(this_obj_conv);
39012 }
39013
39014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39015         LDKChannelDetails this_ptr_conv;
39016         this_ptr_conv.inner = untag_ptr(this_ptr);
39017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39019         this_ptr_conv.is_owned = false;
39020         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39021         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
39022         return ret_arr;
39023 }
39024
39025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39026         LDKChannelDetails this_ptr_conv;
39027         this_ptr_conv.inner = untag_ptr(this_ptr);
39028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39030         this_ptr_conv.is_owned = false;
39031         LDKThirtyTwoBytes val_ref;
39032         CHECK((*env)->GetArrayLength(env, val) == 32);
39033         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39034         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
39035 }
39036
39037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
39038         LDKChannelDetails this_ptr_conv;
39039         this_ptr_conv.inner = untag_ptr(this_ptr);
39040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39042         this_ptr_conv.is_owned = false;
39043         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
39044         int64_t ret_ref = 0;
39045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39047         return ret_ref;
39048 }
39049
39050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39051         LDKChannelDetails this_ptr_conv;
39052         this_ptr_conv.inner = untag_ptr(this_ptr);
39053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39055         this_ptr_conv.is_owned = false;
39056         LDKChannelCounterparty val_conv;
39057         val_conv.inner = untag_ptr(val);
39058         val_conv.is_owned = ptr_is_owned(val);
39059         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39060         val_conv = ChannelCounterparty_clone(&val_conv);
39061         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
39062 }
39063
39064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
39065         LDKChannelDetails this_ptr_conv;
39066         this_ptr_conv.inner = untag_ptr(this_ptr);
39067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39069         this_ptr_conv.is_owned = false;
39070         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
39071         int64_t ret_ref = 0;
39072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39074         return ret_ref;
39075 }
39076
39077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39078         LDKChannelDetails this_ptr_conv;
39079         this_ptr_conv.inner = untag_ptr(this_ptr);
39080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39082         this_ptr_conv.is_owned = false;
39083         LDKOutPoint val_conv;
39084         val_conv.inner = untag_ptr(val);
39085         val_conv.is_owned = ptr_is_owned(val);
39086         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39087         val_conv = OutPoint_clone(&val_conv);
39088         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
39089 }
39090
39091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
39092         LDKChannelDetails this_ptr_conv;
39093         this_ptr_conv.inner = untag_ptr(this_ptr);
39094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39096         this_ptr_conv.is_owned = false;
39097         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
39098         int64_t ret_ref = 0;
39099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39101         return ret_ref;
39102 }
39103
39104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39105         LDKChannelDetails this_ptr_conv;
39106         this_ptr_conv.inner = untag_ptr(this_ptr);
39107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39109         this_ptr_conv.is_owned = false;
39110         LDKChannelTypeFeatures val_conv;
39111         val_conv.inner = untag_ptr(val);
39112         val_conv.is_owned = ptr_is_owned(val);
39113         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39114         val_conv = ChannelTypeFeatures_clone(&val_conv);
39115         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
39116 }
39117
39118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39119         LDKChannelDetails this_ptr_conv;
39120         this_ptr_conv.inner = untag_ptr(this_ptr);
39121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39123         this_ptr_conv.is_owned = false;
39124         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39125         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
39126         int64_t ret_ref = tag_ptr(ret_copy, true);
39127         return ret_ref;
39128 }
39129
39130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39131         LDKChannelDetails this_ptr_conv;
39132         this_ptr_conv.inner = untag_ptr(this_ptr);
39133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39135         this_ptr_conv.is_owned = false;
39136         void* val_ptr = untag_ptr(val);
39137         CHECK_ACCESS(val_ptr);
39138         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39139         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39140         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
39141 }
39142
39143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
39144         LDKChannelDetails this_ptr_conv;
39145         this_ptr_conv.inner = untag_ptr(this_ptr);
39146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39148         this_ptr_conv.is_owned = false;
39149         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39150         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
39151         int64_t ret_ref = tag_ptr(ret_copy, true);
39152         return ret_ref;
39153 }
39154
39155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39156         LDKChannelDetails this_ptr_conv;
39157         this_ptr_conv.inner = untag_ptr(this_ptr);
39158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39160         this_ptr_conv.is_owned = false;
39161         void* val_ptr = untag_ptr(val);
39162         CHECK_ACCESS(val_ptr);
39163         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39164         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39165         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
39166 }
39167
39168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
39169         LDKChannelDetails this_ptr_conv;
39170         this_ptr_conv.inner = untag_ptr(this_ptr);
39171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39173         this_ptr_conv.is_owned = false;
39174         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39175         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
39176         int64_t ret_ref = tag_ptr(ret_copy, true);
39177         return ret_ref;
39178 }
39179
39180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39181         LDKChannelDetails this_ptr_conv;
39182         this_ptr_conv.inner = untag_ptr(this_ptr);
39183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39185         this_ptr_conv.is_owned = false;
39186         void* val_ptr = untag_ptr(val);
39187         CHECK_ACCESS(val_ptr);
39188         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39189         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39190         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
39191 }
39192
39193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
39194         LDKChannelDetails this_ptr_conv;
39195         this_ptr_conv.inner = untag_ptr(this_ptr);
39196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39198         this_ptr_conv.is_owned = false;
39199         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
39200         return ret_conv;
39201 }
39202
39203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39204         LDKChannelDetails this_ptr_conv;
39205         this_ptr_conv.inner = untag_ptr(this_ptr);
39206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39208         this_ptr_conv.is_owned = false;
39209         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
39210 }
39211
39212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
39213         LDKChannelDetails this_ptr_conv;
39214         this_ptr_conv.inner = untag_ptr(this_ptr);
39215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39217         this_ptr_conv.is_owned = false;
39218         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39219         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
39220         int64_t ret_ref = tag_ptr(ret_copy, true);
39221         return ret_ref;
39222 }
39223
39224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39225         LDKChannelDetails this_ptr_conv;
39226         this_ptr_conv.inner = untag_ptr(this_ptr);
39227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39229         this_ptr_conv.is_owned = false;
39230         void* val_ptr = untag_ptr(val);
39231         CHECK_ACCESS(val_ptr);
39232         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39233         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39234         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
39235 }
39236
39237 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39238         LDKChannelDetails this_ptr_conv;
39239         this_ptr_conv.inner = untag_ptr(this_ptr);
39240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39242         this_ptr_conv.is_owned = false;
39243         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
39244         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
39245         return ret_arr;
39246 }
39247
39248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39249         LDKChannelDetails this_ptr_conv;
39250         this_ptr_conv.inner = untag_ptr(this_ptr);
39251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39253         this_ptr_conv.is_owned = false;
39254         LDKU128 val_ref;
39255         CHECK((*env)->GetArrayLength(env, val) == 16);
39256         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
39257         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
39258 }
39259
39260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
39261         LDKChannelDetails this_ptr_conv;
39262         this_ptr_conv.inner = untag_ptr(this_ptr);
39263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39265         this_ptr_conv.is_owned = false;
39266         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39267         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
39268         int64_t ret_ref = tag_ptr(ret_copy, true);
39269         return ret_ref;
39270 }
39271
39272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39273         LDKChannelDetails this_ptr_conv;
39274         this_ptr_conv.inner = untag_ptr(this_ptr);
39275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39277         this_ptr_conv.is_owned = false;
39278         void* val_ptr = untag_ptr(val);
39279         CHECK_ACCESS(val_ptr);
39280         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39281         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39282         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
39283 }
39284
39285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39286         LDKChannelDetails this_ptr_conv;
39287         this_ptr_conv.inner = untag_ptr(this_ptr);
39288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39290         this_ptr_conv.is_owned = false;
39291         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
39292         return ret_conv;
39293 }
39294
39295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39296         LDKChannelDetails this_ptr_conv;
39297         this_ptr_conv.inner = untag_ptr(this_ptr);
39298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39300         this_ptr_conv.is_owned = false;
39301         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
39302 }
39303
39304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39305         LDKChannelDetails this_ptr_conv;
39306         this_ptr_conv.inner = untag_ptr(this_ptr);
39307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39309         this_ptr_conv.is_owned = false;
39310         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
39311         return ret_conv;
39312 }
39313
39314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39315         LDKChannelDetails this_ptr_conv;
39316         this_ptr_conv.inner = untag_ptr(this_ptr);
39317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39319         this_ptr_conv.is_owned = false;
39320         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
39321 }
39322
39323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39324         LDKChannelDetails this_ptr_conv;
39325         this_ptr_conv.inner = untag_ptr(this_ptr);
39326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39328         this_ptr_conv.is_owned = false;
39329         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
39330         return ret_conv;
39331 }
39332
39333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39334         LDKChannelDetails this_ptr_conv;
39335         this_ptr_conv.inner = untag_ptr(this_ptr);
39336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39338         this_ptr_conv.is_owned = false;
39339         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
39340 }
39341
39342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39343         LDKChannelDetails this_ptr_conv;
39344         this_ptr_conv.inner = untag_ptr(this_ptr);
39345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39347         this_ptr_conv.is_owned = false;
39348         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
39349         return ret_conv;
39350 }
39351
39352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39353         LDKChannelDetails this_ptr_conv;
39354         this_ptr_conv.inner = untag_ptr(this_ptr);
39355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39357         this_ptr_conv.is_owned = false;
39358         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
39359 }
39360
39361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39362         LDKChannelDetails this_ptr_conv;
39363         this_ptr_conv.inner = untag_ptr(this_ptr);
39364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39366         this_ptr_conv.is_owned = false;
39367         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
39368         return ret_conv;
39369 }
39370
39371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39372         LDKChannelDetails this_ptr_conv;
39373         this_ptr_conv.inner = untag_ptr(this_ptr);
39374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39376         this_ptr_conv.is_owned = false;
39377         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
39378 }
39379
39380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
39381         LDKChannelDetails this_ptr_conv;
39382         this_ptr_conv.inner = untag_ptr(this_ptr);
39383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39385         this_ptr_conv.is_owned = false;
39386         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39387         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
39388         int64_t ret_ref = tag_ptr(ret_copy, true);
39389         return ret_ref;
39390 }
39391
39392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39393         LDKChannelDetails this_ptr_conv;
39394         this_ptr_conv.inner = untag_ptr(this_ptr);
39395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39397         this_ptr_conv.is_owned = false;
39398         void* val_ptr = untag_ptr(val);
39399         CHECK_ACCESS(val_ptr);
39400         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39401         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39402         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
39403 }
39404
39405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
39406         LDKChannelDetails this_ptr_conv;
39407         this_ptr_conv.inner = untag_ptr(this_ptr);
39408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39410         this_ptr_conv.is_owned = false;
39411         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39412         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
39413         int64_t ret_ref = tag_ptr(ret_copy, true);
39414         return ret_ref;
39415 }
39416
39417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39418         LDKChannelDetails this_ptr_conv;
39419         this_ptr_conv.inner = untag_ptr(this_ptr);
39420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39422         this_ptr_conv.is_owned = false;
39423         void* val_ptr = untag_ptr(val);
39424         CHECK_ACCESS(val_ptr);
39425         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39426         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39427         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
39428 }
39429
39430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
39431         LDKChannelDetails this_ptr_conv;
39432         this_ptr_conv.inner = untag_ptr(this_ptr);
39433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39435         this_ptr_conv.is_owned = false;
39436         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
39437         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
39438         int64_t ret_ref = tag_ptr(ret_copy, true);
39439         return ret_ref;
39440 }
39441
39442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39443         LDKChannelDetails this_ptr_conv;
39444         this_ptr_conv.inner = untag_ptr(this_ptr);
39445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39447         this_ptr_conv.is_owned = false;
39448         void* val_ptr = untag_ptr(val);
39449         CHECK_ACCESS(val_ptr);
39450         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
39451         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
39452         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
39453 }
39454
39455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
39456         LDKChannelDetails this_ptr_conv;
39457         this_ptr_conv.inner = untag_ptr(this_ptr);
39458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39460         this_ptr_conv.is_owned = false;
39461         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
39462         return ret_conv;
39463 }
39464
39465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39466         LDKChannelDetails this_ptr_conv;
39467         this_ptr_conv.inner = untag_ptr(this_ptr);
39468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39470         this_ptr_conv.is_owned = false;
39471         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
39472 }
39473
39474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
39475         LDKChannelDetails this_ptr_conv;
39476         this_ptr_conv.inner = untag_ptr(this_ptr);
39477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39479         this_ptr_conv.is_owned = false;
39480         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
39481         return ret_conv;
39482 }
39483
39484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39485         LDKChannelDetails this_ptr_conv;
39486         this_ptr_conv.inner = untag_ptr(this_ptr);
39487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39489         this_ptr_conv.is_owned = false;
39490         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
39491 }
39492
39493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
39494         LDKChannelDetails this_ptr_conv;
39495         this_ptr_conv.inner = untag_ptr(this_ptr);
39496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39498         this_ptr_conv.is_owned = false;
39499         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
39500         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
39501         int64_t ret_ref = tag_ptr(ret_copy, true);
39502         return ret_ref;
39503 }
39504
39505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39506         LDKChannelDetails this_ptr_conv;
39507         this_ptr_conv.inner = untag_ptr(this_ptr);
39508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39510         this_ptr_conv.is_owned = false;
39511         void* val_ptr = untag_ptr(val);
39512         CHECK_ACCESS(val_ptr);
39513         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
39514         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
39515         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
39516 }
39517
39518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
39519         LDKChannelDetails this_ptr_conv;
39520         this_ptr_conv.inner = untag_ptr(this_ptr);
39521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39523         this_ptr_conv.is_owned = false;
39524         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
39525         return ret_conv;
39526 }
39527
39528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39529         LDKChannelDetails this_ptr_conv;
39530         this_ptr_conv.inner = untag_ptr(this_ptr);
39531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39533         this_ptr_conv.is_owned = false;
39534         ChannelDetails_set_is_usable(&this_ptr_conv, val);
39535 }
39536
39537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
39538         LDKChannelDetails this_ptr_conv;
39539         this_ptr_conv.inner = untag_ptr(this_ptr);
39540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39542         this_ptr_conv.is_owned = false;
39543         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
39544         return ret_conv;
39545 }
39546
39547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39548         LDKChannelDetails this_ptr_conv;
39549         this_ptr_conv.inner = untag_ptr(this_ptr);
39550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39552         this_ptr_conv.is_owned = false;
39553         ChannelDetails_set_is_public(&this_ptr_conv, val);
39554 }
39555
39556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39557         LDKChannelDetails this_ptr_conv;
39558         this_ptr_conv.inner = untag_ptr(this_ptr);
39559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39561         this_ptr_conv.is_owned = false;
39562         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39563         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
39564         int64_t ret_ref = tag_ptr(ret_copy, true);
39565         return ret_ref;
39566 }
39567
39568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39569         LDKChannelDetails this_ptr_conv;
39570         this_ptr_conv.inner = untag_ptr(this_ptr);
39571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39573         this_ptr_conv.is_owned = false;
39574         void* val_ptr = untag_ptr(val);
39575         CHECK_ACCESS(val_ptr);
39576         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39577         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39578         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
39579 }
39580
39581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39582         LDKChannelDetails this_ptr_conv;
39583         this_ptr_conv.inner = untag_ptr(this_ptr);
39584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39586         this_ptr_conv.is_owned = false;
39587         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39588         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
39589         int64_t ret_ref = tag_ptr(ret_copy, true);
39590         return ret_ref;
39591 }
39592
39593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39594         LDKChannelDetails this_ptr_conv;
39595         this_ptr_conv.inner = untag_ptr(this_ptr);
39596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39598         this_ptr_conv.is_owned = false;
39599         void* val_ptr = untag_ptr(val);
39600         CHECK_ACCESS(val_ptr);
39601         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39602         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39603         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
39604 }
39605
39606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
39607         LDKChannelDetails this_ptr_conv;
39608         this_ptr_conv.inner = untag_ptr(this_ptr);
39609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39611         this_ptr_conv.is_owned = false;
39612         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
39613         int64_t ret_ref = 0;
39614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39616         return ret_ref;
39617 }
39618
39619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39620         LDKChannelDetails this_ptr_conv;
39621         this_ptr_conv.inner = untag_ptr(this_ptr);
39622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39624         this_ptr_conv.is_owned = false;
39625         LDKChannelConfig val_conv;
39626         val_conv.inner = untag_ptr(val);
39627         val_conv.is_owned = ptr_is_owned(val);
39628         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39629         val_conv = ChannelConfig_clone(&val_conv);
39630         ChannelDetails_set_config(&this_ptr_conv, val_conv);
39631 }
39632
39633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t outbound_scid_alias_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t feerate_sat_per_1000_weight_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t next_outbound_htlc_minimum_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t confirmations_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, int64_t channel_shutdown_state_arg, jboolean is_usable_arg, jboolean is_public_arg, int64_t inbound_htlc_minimum_msat_arg, int64_t inbound_htlc_maximum_msat_arg, int64_t config_arg) {
39634         LDKThirtyTwoBytes channel_id_arg_ref;
39635         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
39636         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
39637         LDKChannelCounterparty counterparty_arg_conv;
39638         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
39639         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
39640         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
39641         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
39642         LDKOutPoint funding_txo_arg_conv;
39643         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
39644         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
39645         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
39646         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
39647         LDKChannelTypeFeatures channel_type_arg_conv;
39648         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
39649         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
39650         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
39651         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
39652         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
39653         CHECK_ACCESS(short_channel_id_arg_ptr);
39654         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
39655         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
39656         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
39657         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
39658         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
39659         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
39660         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
39661         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
39662         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
39663         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
39664         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
39665         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
39666         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
39667         LDKU128 user_channel_id_arg_ref;
39668         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
39669         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
39670         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
39671         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
39672         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
39673         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
39674         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
39675         CHECK_ACCESS(confirmations_required_arg_ptr);
39676         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
39677         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
39678         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
39679         CHECK_ACCESS(confirmations_arg_ptr);
39680         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
39681         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
39682         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
39683         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
39684         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
39685         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
39686         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
39687         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
39688         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
39689         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
39690         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
39691         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
39692         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
39693         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
39694         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
39695         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
39696         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
39697         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
39698         LDKChannelConfig config_arg_conv;
39699         config_arg_conv.inner = untag_ptr(config_arg);
39700         config_arg_conv.is_owned = ptr_is_owned(config_arg);
39701         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
39702         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
39703         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, feerate_sat_per_1000_weight_arg_conv, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, channel_shutdown_state_arg_conv, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
39704         int64_t ret_ref = 0;
39705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39707         return ret_ref;
39708 }
39709
39710 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
39711         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
39712         int64_t ret_ref = 0;
39713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39715         return ret_ref;
39716 }
39717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39718         LDKChannelDetails arg_conv;
39719         arg_conv.inner = untag_ptr(arg);
39720         arg_conv.is_owned = ptr_is_owned(arg);
39721         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39722         arg_conv.is_owned = false;
39723         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
39724         return ret_conv;
39725 }
39726
39727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39728         LDKChannelDetails orig_conv;
39729         orig_conv.inner = untag_ptr(orig);
39730         orig_conv.is_owned = ptr_is_owned(orig);
39731         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39732         orig_conv.is_owned = false;
39733         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
39734         int64_t ret_ref = 0;
39735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39737         return ret_ref;
39738 }
39739
39740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
39741         LDKChannelDetails this_arg_conv;
39742         this_arg_conv.inner = untag_ptr(this_arg);
39743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39745         this_arg_conv.is_owned = false;
39746         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39747         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
39748         int64_t ret_ref = tag_ptr(ret_copy, true);
39749         return ret_ref;
39750 }
39751
39752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
39753         LDKChannelDetails this_arg_conv;
39754         this_arg_conv.inner = untag_ptr(this_arg);
39755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39757         this_arg_conv.is_owned = false;
39758         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39759         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
39760         int64_t ret_ref = tag_ptr(ret_copy, true);
39761         return ret_ref;
39762 }
39763
39764 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39765         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
39766         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
39767         return ret_conv;
39768 }
39769
39770 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
39771         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
39772         return ret_conv;
39773 }
39774
39775 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
39776         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
39777         return ret_conv;
39778 }
39779
39780 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
39781         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
39782         return ret_conv;
39783 }
39784
39785 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
39786         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
39787         return ret_conv;
39788 }
39789
39790 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
39791         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
39792         return ret_conv;
39793 }
39794
39795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39796         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
39797         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
39798         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
39799         return ret_conv;
39800 }
39801
39802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39803         if (!ptr_is_owned(this_ptr)) return;
39804         void* this_ptr_ptr = untag_ptr(this_ptr);
39805         CHECK_ACCESS(this_ptr_ptr);
39806         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
39807         FREE(untag_ptr(this_ptr));
39808         RecentPaymentDetails_free(this_ptr_conv);
39809 }
39810
39811 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
39812         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39813         *ret_copy = RecentPaymentDetails_clone(arg);
39814         int64_t ret_ref = tag_ptr(ret_copy, true);
39815         return ret_ref;
39816 }
39817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39818         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
39819         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
39820         return ret_conv;
39821 }
39822
39823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39824         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
39825         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39826         *ret_copy = RecentPaymentDetails_clone(orig_conv);
39827         int64_t ret_ref = tag_ptr(ret_copy, true);
39828         return ret_ref;
39829 }
39830
39831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1awaiting_1invoice(JNIEnv *env, jclass clz, int8_tArray payment_id) {
39832         LDKThirtyTwoBytes payment_id_ref;
39833         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
39834         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
39835         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39836         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
39837         int64_t ret_ref = tag_ptr(ret_copy, true);
39838         return ret_ref;
39839 }
39840
39841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1pending(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
39842         LDKThirtyTwoBytes payment_id_ref;
39843         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
39844         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
39845         LDKThirtyTwoBytes payment_hash_ref;
39846         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
39847         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
39848         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39849         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
39850         int64_t ret_ref = tag_ptr(ret_copy, true);
39851         return ret_ref;
39852 }
39853
39854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash) {
39855         LDKThirtyTwoBytes payment_id_ref;
39856         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
39857         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
39858         void* payment_hash_ptr = untag_ptr(payment_hash);
39859         CHECK_ACCESS(payment_hash_ptr);
39860         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
39861         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
39862         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39863         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
39864         int64_t ret_ref = tag_ptr(ret_copy, true);
39865         return ret_ref;
39866 }
39867
39868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
39869         LDKThirtyTwoBytes payment_id_ref;
39870         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
39871         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
39872         LDKThirtyTwoBytes payment_hash_ref;
39873         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
39874         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
39875         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
39876         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
39877         int64_t ret_ref = tag_ptr(ret_copy, true);
39878         return ret_ref;
39879 }
39880
39881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39882         LDKPhantomRouteHints this_obj_conv;
39883         this_obj_conv.inner = untag_ptr(this_obj);
39884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39886         PhantomRouteHints_free(this_obj_conv);
39887 }
39888
39889 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
39890         LDKPhantomRouteHints this_ptr_conv;
39891         this_ptr_conv.inner = untag_ptr(this_ptr);
39892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39894         this_ptr_conv.is_owned = false;
39895         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
39896         int64_tArray ret_arr = NULL;
39897         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
39898         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
39899         for (size_t q = 0; q < ret_var.datalen; q++) {
39900                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
39901                 int64_t ret_conv_16_ref = 0;
39902                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
39903                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
39904                 ret_arr_ptr[q] = ret_conv_16_ref;
39905         }
39906         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
39907         FREE(ret_var.data);
39908         return ret_arr;
39909 }
39910
39911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
39912         LDKPhantomRouteHints this_ptr_conv;
39913         this_ptr_conv.inner = untag_ptr(this_ptr);
39914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39916         this_ptr_conv.is_owned = false;
39917         LDKCVec_ChannelDetailsZ val_constr;
39918         val_constr.datalen = (*env)->GetArrayLength(env, val);
39919         if (val_constr.datalen > 0)
39920                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
39921         else
39922                 val_constr.data = NULL;
39923         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
39924         for (size_t q = 0; q < val_constr.datalen; q++) {
39925                 int64_t val_conv_16 = val_vals[q];
39926                 LDKChannelDetails val_conv_16_conv;
39927                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
39928                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
39929                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
39930                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
39931                 val_constr.data[q] = val_conv_16_conv;
39932         }
39933         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
39934         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
39935 }
39936
39937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
39938         LDKPhantomRouteHints this_ptr_conv;
39939         this_ptr_conv.inner = untag_ptr(this_ptr);
39940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39942         this_ptr_conv.is_owned = false;
39943         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
39944         return ret_conv;
39945 }
39946
39947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39948         LDKPhantomRouteHints this_ptr_conv;
39949         this_ptr_conv.inner = untag_ptr(this_ptr);
39950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39952         this_ptr_conv.is_owned = false;
39953         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
39954 }
39955
39956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
39957         LDKPhantomRouteHints this_ptr_conv;
39958         this_ptr_conv.inner = untag_ptr(this_ptr);
39959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39961         this_ptr_conv.is_owned = false;
39962         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39963         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
39964         return ret_arr;
39965 }
39966
39967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39968         LDKPhantomRouteHints this_ptr_conv;
39969         this_ptr_conv.inner = untag_ptr(this_ptr);
39970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39972         this_ptr_conv.is_owned = false;
39973         LDKPublicKey val_ref;
39974         CHECK((*env)->GetArrayLength(env, val) == 33);
39975         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39976         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
39977 }
39978
39979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
39980         LDKCVec_ChannelDetailsZ channels_arg_constr;
39981         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
39982         if (channels_arg_constr.datalen > 0)
39983                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
39984         else
39985                 channels_arg_constr.data = NULL;
39986         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
39987         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
39988                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
39989                 LDKChannelDetails channels_arg_conv_16_conv;
39990                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
39991                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
39992                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
39993                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
39994                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
39995         }
39996         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
39997         LDKPublicKey real_node_pubkey_arg_ref;
39998         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
39999         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
40000         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
40001         int64_t ret_ref = 0;
40002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40004         return ret_ref;
40005 }
40006
40007 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
40008         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
40009         int64_t ret_ref = 0;
40010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40012         return ret_ref;
40013 }
40014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40015         LDKPhantomRouteHints arg_conv;
40016         arg_conv.inner = untag_ptr(arg);
40017         arg_conv.is_owned = ptr_is_owned(arg);
40018         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40019         arg_conv.is_owned = false;
40020         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
40021         return ret_conv;
40022 }
40023
40024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40025         LDKPhantomRouteHints orig_conv;
40026         orig_conv.inner = untag_ptr(orig);
40027         orig_conv.is_owned = ptr_is_owned(orig);
40028         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40029         orig_conv.is_owned = false;
40030         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
40031         int64_t ret_ref = 0;
40032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40034         return ret_ref;
40035 }
40036
40037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t config, int64_t params, int32_t current_timestamp) {
40038         void* fee_est_ptr = untag_ptr(fee_est);
40039         CHECK_ACCESS(fee_est_ptr);
40040         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
40041         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
40042                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40043                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
40044         }
40045         void* chain_monitor_ptr = untag_ptr(chain_monitor);
40046         CHECK_ACCESS(chain_monitor_ptr);
40047         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
40048         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
40049                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40050                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
40051         }
40052         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
40053         CHECK_ACCESS(tx_broadcaster_ptr);
40054         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
40055         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40056                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40057                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
40058         }
40059         void* router_ptr = untag_ptr(router);
40060         CHECK_ACCESS(router_ptr);
40061         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
40062         if (router_conv.free == LDKRouter_JCalls_free) {
40063                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40064                 LDKRouter_JCalls_cloned(&router_conv);
40065         }
40066         void* logger_ptr = untag_ptr(logger);
40067         CHECK_ACCESS(logger_ptr);
40068         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40069         if (logger_conv.free == LDKLogger_JCalls_free) {
40070                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40071                 LDKLogger_JCalls_cloned(&logger_conv);
40072         }
40073         void* entropy_source_ptr = untag_ptr(entropy_source);
40074         CHECK_ACCESS(entropy_source_ptr);
40075         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
40076         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
40077                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40078                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
40079         }
40080         void* node_signer_ptr = untag_ptr(node_signer);
40081         CHECK_ACCESS(node_signer_ptr);
40082         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
40083         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
40084                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40085                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
40086         }
40087         void* signer_provider_ptr = untag_ptr(signer_provider);
40088         CHECK_ACCESS(signer_provider_ptr);
40089         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
40090         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
40091                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40092                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
40093         }
40094         LDKUserConfig config_conv;
40095         config_conv.inner = untag_ptr(config);
40096         config_conv.is_owned = ptr_is_owned(config);
40097         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
40098         config_conv = UserConfig_clone(&config_conv);
40099         LDKChainParameters params_conv;
40100         params_conv.inner = untag_ptr(params);
40101         params_conv.is_owned = ptr_is_owned(params);
40102         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
40103         params_conv = ChainParameters_clone(&params_conv);
40104         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, entropy_source_conv, node_signer_conv, signer_provider_conv, config_conv, params_conv, current_timestamp);
40105         int64_t ret_ref = 0;
40106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40108         return ret_ref;
40109 }
40110
40111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
40112         LDKChannelManager this_arg_conv;
40113         this_arg_conv.inner = untag_ptr(this_arg);
40114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40116         this_arg_conv.is_owned = false;
40117         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
40118         int64_t ret_ref = 0;
40119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40121         return ret_ref;
40122 }
40123
40124 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, int8_tArray user_channel_id, int64_t override_config) {
40125         LDKChannelManager this_arg_conv;
40126         this_arg_conv.inner = untag_ptr(this_arg);
40127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40129         this_arg_conv.is_owned = false;
40130         LDKPublicKey their_network_key_ref;
40131         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
40132         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
40133         LDKU128 user_channel_id_ref;
40134         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
40135         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
40136         LDKUserConfig override_config_conv;
40137         override_config_conv.inner = untag_ptr(override_config);
40138         override_config_conv.is_owned = ptr_is_owned(override_config);
40139         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
40140         override_config_conv = UserConfig_clone(&override_config_conv);
40141         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
40142         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
40143         return tag_ptr(ret_conv, true);
40144 }
40145
40146 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40147         LDKChannelManager this_arg_conv;
40148         this_arg_conv.inner = untag_ptr(this_arg);
40149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40151         this_arg_conv.is_owned = false;
40152         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
40153         int64_tArray ret_arr = NULL;
40154         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40155         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40156         for (size_t q = 0; q < ret_var.datalen; q++) {
40157                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40158                 int64_t ret_conv_16_ref = 0;
40159                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40160                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40161                 ret_arr_ptr[q] = ret_conv_16_ref;
40162         }
40163         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40164         FREE(ret_var.data);
40165         return ret_arr;
40166 }
40167
40168 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40169         LDKChannelManager this_arg_conv;
40170         this_arg_conv.inner = untag_ptr(this_arg);
40171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40173         this_arg_conv.is_owned = false;
40174         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
40175         int64_tArray ret_arr = NULL;
40176         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40177         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40178         for (size_t q = 0; q < ret_var.datalen; q++) {
40179                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40180                 int64_t ret_conv_16_ref = 0;
40181                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40182                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40183                 ret_arr_ptr[q] = ret_conv_16_ref;
40184         }
40185         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40186         FREE(ret_var.data);
40187         return ret_arr;
40188 }
40189
40190 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels_1with_1counterparty(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id) {
40191         LDKChannelManager this_arg_conv;
40192         this_arg_conv.inner = untag_ptr(this_arg);
40193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40195         this_arg_conv.is_owned = false;
40196         LDKPublicKey counterparty_node_id_ref;
40197         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40198         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40199         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
40200         int64_tArray ret_arr = NULL;
40201         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40202         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40203         for (size_t q = 0; q < ret_var.datalen; q++) {
40204                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40205                 int64_t ret_conv_16_ref = 0;
40206                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40207                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40208                 ret_arr_ptr[q] = ret_conv_16_ref;
40209         }
40210         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40211         FREE(ret_var.data);
40212         return ret_arr;
40213 }
40214
40215 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
40216         LDKChannelManager this_arg_conv;
40217         this_arg_conv.inner = untag_ptr(this_arg);
40218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40220         this_arg_conv.is_owned = false;
40221         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
40222         int64_tArray ret_arr = NULL;
40223         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40224         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40225         for (size_t w = 0; w < ret_var.datalen; w++) {
40226                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40227                 *ret_conv_22_copy = ret_var.data[w];
40228                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
40229                 ret_arr_ptr[w] = ret_conv_22_ref;
40230         }
40231         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40232         FREE(ret_var.data);
40233         return ret_arr;
40234 }
40235
40236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
40237         LDKChannelManager this_arg_conv;
40238         this_arg_conv.inner = untag_ptr(this_arg);
40239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40241         this_arg_conv.is_owned = false;
40242         uint8_t channel_id_arr[32];
40243         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40244         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40245         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40246         LDKPublicKey counterparty_node_id_ref;
40247         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40248         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40249         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40250         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40251         return tag_ptr(ret_conv, true);
40252 }
40253
40254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1feerate_1and_1script(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
40255         LDKChannelManager this_arg_conv;
40256         this_arg_conv.inner = untag_ptr(this_arg);
40257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40259         this_arg_conv.is_owned = false;
40260         uint8_t channel_id_arr[32];
40261         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40262         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40263         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40264         LDKPublicKey counterparty_node_id_ref;
40265         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40266         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40267         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
40268         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
40269         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
40270         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
40271         LDKShutdownScript shutdown_script_conv;
40272         shutdown_script_conv.inner = untag_ptr(shutdown_script);
40273         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
40274         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
40275         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
40276         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40277         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
40278         return tag_ptr(ret_conv, true);
40279 }
40280
40281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
40282         LDKChannelManager this_arg_conv;
40283         this_arg_conv.inner = untag_ptr(this_arg);
40284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40286         this_arg_conv.is_owned = false;
40287         uint8_t channel_id_arr[32];
40288         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40289         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40290         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40291         LDKPublicKey counterparty_node_id_ref;
40292         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40293         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40294         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40295         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40296         return tag_ptr(ret_conv, true);
40297 }
40298
40299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
40300         LDKChannelManager this_arg_conv;
40301         this_arg_conv.inner = untag_ptr(this_arg);
40302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40304         this_arg_conv.is_owned = false;
40305         uint8_t channel_id_arr[32];
40306         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40307         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40308         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40309         LDKPublicKey counterparty_node_id_ref;
40310         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40311         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40312         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40313         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40314         return tag_ptr(ret_conv, true);
40315 }
40316
40317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
40318         LDKChannelManager this_arg_conv;
40319         this_arg_conv.inner = untag_ptr(this_arg);
40320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40322         this_arg_conv.is_owned = false;
40323         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
40324 }
40325
40326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
40327         LDKChannelManager this_arg_conv;
40328         this_arg_conv.inner = untag_ptr(this_arg);
40329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40331         this_arg_conv.is_owned = false;
40332         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
40333 }
40334
40335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment_1with_1route(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id) {
40336         LDKChannelManager this_arg_conv;
40337         this_arg_conv.inner = untag_ptr(this_arg);
40338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40340         this_arg_conv.is_owned = false;
40341         LDKRoute route_conv;
40342         route_conv.inner = untag_ptr(route);
40343         route_conv.is_owned = ptr_is_owned(route);
40344         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
40345         route_conv.is_owned = false;
40346         LDKThirtyTwoBytes payment_hash_ref;
40347         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40348         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40349         LDKRecipientOnionFields recipient_onion_conv;
40350         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40351         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40352         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40353         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40354         LDKThirtyTwoBytes payment_id_ref;
40355         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40356         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40357         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
40358         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
40359         return tag_ptr(ret_conv, true);
40360 }
40361
40362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
40363         LDKChannelManager this_arg_conv;
40364         this_arg_conv.inner = untag_ptr(this_arg);
40365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40367         this_arg_conv.is_owned = false;
40368         LDKThirtyTwoBytes payment_hash_ref;
40369         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40370         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40371         LDKRecipientOnionFields recipient_onion_conv;
40372         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40373         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40374         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40375         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40376         LDKThirtyTwoBytes payment_id_ref;
40377         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40378         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40379         LDKRouteParameters route_params_conv;
40380         route_params_conv.inner = untag_ptr(route_params);
40381         route_params_conv.is_owned = ptr_is_owned(route_params);
40382         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40383         route_params_conv = RouteParameters_clone(&route_params_conv);
40384         void* retry_strategy_ptr = untag_ptr(retry_strategy);
40385         CHECK_ACCESS(retry_strategy_ptr);
40386         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
40387         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
40388         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
40389         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
40390         return tag_ptr(ret_conv, true);
40391 }
40392
40393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
40394         LDKChannelManager this_arg_conv;
40395         this_arg_conv.inner = untag_ptr(this_arg);
40396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40398         this_arg_conv.is_owned = false;
40399         LDKThirtyTwoBytes payment_id_ref;
40400         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40401         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40402         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
40403 }
40404
40405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id) {
40406         LDKChannelManager this_arg_conv;
40407         this_arg_conv.inner = untag_ptr(this_arg);
40408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40410         this_arg_conv.is_owned = false;
40411         LDKRoute route_conv;
40412         route_conv.inner = untag_ptr(route);
40413         route_conv.is_owned = ptr_is_owned(route);
40414         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
40415         route_conv.is_owned = false;
40416         void* payment_preimage_ptr = untag_ptr(payment_preimage);
40417         CHECK_ACCESS(payment_preimage_ptr);
40418         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
40419         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
40420         LDKRecipientOnionFields recipient_onion_conv;
40421         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40422         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40423         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40424         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40425         LDKThirtyTwoBytes payment_id_ref;
40426         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40427         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40428         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
40429         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
40430         return tag_ptr(ret_conv, true);
40431 }
40432
40433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment_1with_1retry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
40434         LDKChannelManager this_arg_conv;
40435         this_arg_conv.inner = untag_ptr(this_arg);
40436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40438         this_arg_conv.is_owned = false;
40439         void* payment_preimage_ptr = untag_ptr(payment_preimage);
40440         CHECK_ACCESS(payment_preimage_ptr);
40441         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
40442         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
40443         LDKRecipientOnionFields recipient_onion_conv;
40444         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40445         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40447         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40448         LDKThirtyTwoBytes payment_id_ref;
40449         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40450         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40451         LDKRouteParameters route_params_conv;
40452         route_params_conv.inner = untag_ptr(route_params);
40453         route_params_conv.is_owned = ptr_is_owned(route_params);
40454         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40455         route_params_conv = RouteParameters_clone(&route_params_conv);
40456         void* retry_strategy_ptr = untag_ptr(retry_strategy);
40457         CHECK_ACCESS(retry_strategy_ptr);
40458         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
40459         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
40460         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
40461         *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
40462         return tag_ptr(ret_conv, true);
40463 }
40464
40465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
40466         LDKChannelManager this_arg_conv;
40467         this_arg_conv.inner = untag_ptr(this_arg);
40468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40470         this_arg_conv.is_owned = false;
40471         LDKPath path_conv;
40472         path_conv.inner = untag_ptr(path);
40473         path_conv.is_owned = ptr_is_owned(path);
40474         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
40475         path_conv = Path_clone(&path_conv);
40476         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
40477         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
40478         return tag_ptr(ret_conv, true);
40479 }
40480
40481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1preflight_1probes(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id, int64_t amount_msat, int32_t final_cltv_expiry_delta, int64_t liquidity_limit_multiplier) {
40482         LDKChannelManager this_arg_conv;
40483         this_arg_conv.inner = untag_ptr(this_arg);
40484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40486         this_arg_conv.is_owned = false;
40487         LDKPublicKey node_id_ref;
40488         CHECK((*env)->GetArrayLength(env, node_id) == 33);
40489         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
40490         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
40491         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
40492         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
40493         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
40494         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
40495         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
40496         return tag_ptr(ret_conv, true);
40497 }
40498
40499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1preflight_1probes(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route_params, int64_t liquidity_limit_multiplier) {
40500         LDKChannelManager this_arg_conv;
40501         this_arg_conv.inner = untag_ptr(this_arg);
40502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40504         this_arg_conv.is_owned = false;
40505         LDKRouteParameters route_params_conv;
40506         route_params_conv.inner = untag_ptr(route_params);
40507         route_params_conv.is_owned = ptr_is_owned(route_params);
40508         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40509         route_params_conv = RouteParameters_clone(&route_params_conv);
40510         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
40511         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
40512         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
40513         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
40514         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
40515         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
40516         return tag_ptr(ret_conv, true);
40517 }
40518
40519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
40520         LDKChannelManager this_arg_conv;
40521         this_arg_conv.inner = untag_ptr(this_arg);
40522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40524         this_arg_conv.is_owned = false;
40525         uint8_t temporary_channel_id_arr[32];
40526         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
40527         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
40528         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
40529         LDKPublicKey counterparty_node_id_ref;
40530         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40531         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40532         LDKTransaction funding_transaction_ref;
40533         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
40534         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
40535         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
40536         funding_transaction_ref.data_is_owned = true;
40537         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40538         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
40539         return tag_ptr(ret_conv, true);
40540 }
40541
40542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1batch_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray temporary_channels, int8_tArray funding_transaction) {
40543         LDKChannelManager this_arg_conv;
40544         this_arg_conv.inner = untag_ptr(this_arg);
40545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40547         this_arg_conv.is_owned = false;
40548         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
40549         temporary_channels_constr.datalen = (*env)->GetArrayLength(env, temporary_channels);
40550         if (temporary_channels_constr.datalen > 0)
40551                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
40552         else
40553                 temporary_channels_constr.data = NULL;
40554         int64_t* temporary_channels_vals = (*env)->GetLongArrayElements (env, temporary_channels, NULL);
40555         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
40556                 int64_t temporary_channels_conv_35 = temporary_channels_vals[j];
40557                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
40558                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
40559                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
40560                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
40561                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
40562         }
40563         (*env)->ReleaseLongArrayElements(env, temporary_channels, temporary_channels_vals, 0);
40564         LDKTransaction funding_transaction_ref;
40565         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
40566         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
40567         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
40568         funding_transaction_ref.data_is_owned = true;
40569         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40570         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
40571         return tag_ptr(ret_conv, true);
40572 }
40573
40574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1partial_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config_update) {
40575         LDKChannelManager this_arg_conv;
40576         this_arg_conv.inner = untag_ptr(this_arg);
40577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40579         this_arg_conv.is_owned = false;
40580         LDKPublicKey counterparty_node_id_ref;
40581         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40582         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40583         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
40584         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
40585         if (channel_ids_constr.datalen > 0)
40586                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
40587         else
40588                 channel_ids_constr.data = NULL;
40589         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
40590                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
40591                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
40592                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
40593                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
40594                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
40595         }
40596         LDKChannelConfigUpdate config_update_conv;
40597         config_update_conv.inner = untag_ptr(config_update);
40598         config_update_conv.is_owned = ptr_is_owned(config_update);
40599         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
40600         config_update_conv.is_owned = false;
40601         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40602         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
40603         return tag_ptr(ret_conv, true);
40604 }
40605
40606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config) {
40607         LDKChannelManager this_arg_conv;
40608         this_arg_conv.inner = untag_ptr(this_arg);
40609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40611         this_arg_conv.is_owned = false;
40612         LDKPublicKey counterparty_node_id_ref;
40613         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40614         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40615         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
40616         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
40617         if (channel_ids_constr.datalen > 0)
40618                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
40619         else
40620                 channel_ids_constr.data = NULL;
40621         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
40622                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
40623                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
40624                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
40625                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
40626                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
40627         }
40628         LDKChannelConfig config_conv;
40629         config_conv.inner = untag_ptr(config);
40630         config_conv.is_owned = ptr_is_owned(config);
40631         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
40632         config_conv.is_owned = false;
40633         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40634         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
40635         return tag_ptr(ret_conv, true);
40636 }
40637
40638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
40639         LDKChannelManager this_arg_conv;
40640         this_arg_conv.inner = untag_ptr(this_arg);
40641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40643         this_arg_conv.is_owned = false;
40644         LDKThirtyTwoBytes intercept_id_ref;
40645         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
40646         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
40647         uint8_t next_hop_channel_id_arr[32];
40648         CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32);
40649         (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr);
40650         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
40651         LDKPublicKey next_node_id_ref;
40652         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
40653         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
40654         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40655         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, next_node_id_ref, amt_to_forward_msat);
40656         return tag_ptr(ret_conv, true);
40657 }
40658
40659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id) {
40660         LDKChannelManager this_arg_conv;
40661         this_arg_conv.inner = untag_ptr(this_arg);
40662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40664         this_arg_conv.is_owned = false;
40665         LDKThirtyTwoBytes intercept_id_ref;
40666         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
40667         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
40668         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40669         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
40670         return tag_ptr(ret_conv, true);
40671 }
40672
40673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
40674         LDKChannelManager this_arg_conv;
40675         this_arg_conv.inner = untag_ptr(this_arg);
40676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40678         this_arg_conv.is_owned = false;
40679         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
40680 }
40681
40682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
40683         LDKChannelManager this_arg_conv;
40684         this_arg_conv.inner = untag_ptr(this_arg);
40685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40687         this_arg_conv.is_owned = false;
40688         ChannelManager_timer_tick_occurred(&this_arg_conv);
40689 }
40690
40691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
40692         LDKChannelManager this_arg_conv;
40693         this_arg_conv.inner = untag_ptr(this_arg);
40694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40696         this_arg_conv.is_owned = false;
40697         uint8_t payment_hash_arr[32];
40698         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40699         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
40700         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
40701         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
40702 }
40703
40704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards_1with_1reason(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t failure_code) {
40705         LDKChannelManager this_arg_conv;
40706         this_arg_conv.inner = untag_ptr(this_arg);
40707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40709         this_arg_conv.is_owned = false;
40710         uint8_t payment_hash_arr[32];
40711         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40712         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
40713         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
40714         void* failure_code_ptr = untag_ptr(failure_code);
40715         CHECK_ACCESS(failure_code_ptr);
40716         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
40717         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
40718         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
40719 }
40720
40721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
40722         LDKChannelManager this_arg_conv;
40723         this_arg_conv.inner = untag_ptr(this_arg);
40724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40726         this_arg_conv.is_owned = false;
40727         LDKThirtyTwoBytes payment_preimage_ref;
40728         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
40729         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
40730         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
40731 }
40732
40733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds_1with_1known_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
40734         LDKChannelManager this_arg_conv;
40735         this_arg_conv.inner = untag_ptr(this_arg);
40736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40738         this_arg_conv.is_owned = false;
40739         LDKThirtyTwoBytes payment_preimage_ref;
40740         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
40741         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
40742         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
40743 }
40744
40745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
40746         LDKChannelManager this_arg_conv;
40747         this_arg_conv.inner = untag_ptr(this_arg);
40748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40750         this_arg_conv.is_owned = false;
40751         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40752         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
40753         return ret_arr;
40754 }
40755
40756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
40757         LDKChannelManager this_arg_conv;
40758         this_arg_conv.inner = untag_ptr(this_arg);
40759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40761         this_arg_conv.is_owned = false;
40762         uint8_t temporary_channel_id_arr[32];
40763         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
40764         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
40765         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
40766         LDKPublicKey counterparty_node_id_ref;
40767         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40768         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40769         LDKU128 user_channel_id_ref;
40770         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
40771         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
40772         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40773         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
40774         return tag_ptr(ret_conv, true);
40775 }
40776
40777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel_1from_1trusted_1peer_10conf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
40778         LDKChannelManager this_arg_conv;
40779         this_arg_conv.inner = untag_ptr(this_arg);
40780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40782         this_arg_conv.is_owned = false;
40783         uint8_t temporary_channel_id_arr[32];
40784         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
40785         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
40786         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
40787         LDKPublicKey counterparty_node_id_ref;
40788         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40789         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40790         LDKU128 user_channel_id_ref;
40791         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
40792         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
40793         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40794         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
40795         return tag_ptr(ret_conv, true);
40796 }
40797
40798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
40799         LDKChannelManager this_arg_conv;
40800         this_arg_conv.inner = untag_ptr(this_arg);
40801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40803         this_arg_conv.is_owned = false;
40804         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40805         CHECK_ACCESS(min_value_msat_ptr);
40806         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40807         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40808         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40809         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40810         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40811         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40812         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
40813         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
40814         return tag_ptr(ret_conv, true);
40815 }
40816
40817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry) {
40818         LDKChannelManager this_arg_conv;
40819         this_arg_conv.inner = untag_ptr(this_arg);
40820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40822         this_arg_conv.is_owned = false;
40823         LDKThirtyTwoBytes payment_hash_ref;
40824         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40825         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40826         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40827         CHECK_ACCESS(min_value_msat_ptr);
40828         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40829         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40830         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
40831         CHECK_ACCESS(min_final_cltv_expiry_ptr);
40832         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
40833         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
40834         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
40835         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_conv);
40836         return tag_ptr(ret_conv, true);
40837 }
40838
40839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
40840         LDKChannelManager this_arg_conv;
40841         this_arg_conv.inner = untag_ptr(this_arg);
40842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40844         this_arg_conv.is_owned = false;
40845         LDKThirtyTwoBytes payment_hash_ref;
40846         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40847         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40848         LDKThirtyTwoBytes payment_secret_ref;
40849         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
40850         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
40851         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
40852         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
40853         return tag_ptr(ret_conv, true);
40854 }
40855
40856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
40857         LDKChannelManager this_arg_conv;
40858         this_arg_conv.inner = untag_ptr(this_arg);
40859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40861         this_arg_conv.is_owned = false;
40862         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
40863         return ret_conv;
40864 }
40865
40866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
40867         LDKChannelManager this_arg_conv;
40868         this_arg_conv.inner = untag_ptr(this_arg);
40869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40871         this_arg_conv.is_owned = false;
40872         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
40873         int64_t ret_ref = 0;
40874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40876         return ret_ref;
40877 }
40878
40879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
40880         LDKChannelManager this_arg_conv;
40881         this_arg_conv.inner = untag_ptr(this_arg);
40882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40884         this_arg_conv.is_owned = false;
40885         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
40886         return ret_conv;
40887 }
40888
40889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
40890         LDKChannelManager this_arg_conv;
40891         this_arg_conv.inner = untag_ptr(this_arg);
40892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40894         this_arg_conv.is_owned = false;
40895         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
40896         int64_t ret_ref = 0;
40897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40899         return ret_ref;
40900 }
40901
40902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
40903         LDKChannelManager this_arg_conv;
40904         this_arg_conv.inner = untag_ptr(this_arg);
40905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40907         this_arg_conv.is_owned = false;
40908         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
40909         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
40910         return tag_ptr(ret_ret, true);
40911 }
40912
40913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
40914         LDKChannelManager this_arg_conv;
40915         this_arg_conv.inner = untag_ptr(this_arg);
40916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40918         this_arg_conv.is_owned = false;
40919         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
40920         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
40921         return tag_ptr(ret_ret, true);
40922 }
40923
40924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
40925         LDKChannelManager this_arg_conv;
40926         this_arg_conv.inner = untag_ptr(this_arg);
40927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40929         this_arg_conv.is_owned = false;
40930         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
40931         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
40932         return tag_ptr(ret_ret, true);
40933 }
40934
40935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
40936         LDKChannelManager this_arg_conv;
40937         this_arg_conv.inner = untag_ptr(this_arg);
40938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40940         this_arg_conv.is_owned = false;
40941         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
40942         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
40943         return tag_ptr(ret_ret, true);
40944 }
40945
40946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1event_1or_1persistence_1needed_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
40947         LDKChannelManager this_arg_conv;
40948         this_arg_conv.inner = untag_ptr(this_arg);
40949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40951         this_arg_conv.is_owned = false;
40952         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
40953         int64_t ret_ref = 0;
40954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40956         return ret_ref;
40957 }
40958
40959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1and_1clear_1needs_1persistence(JNIEnv *env, jclass clz, int64_t this_arg) {
40960         LDKChannelManager this_arg_conv;
40961         this_arg_conv.inner = untag_ptr(this_arg);
40962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40964         this_arg_conv.is_owned = false;
40965         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
40966         return ret_conv;
40967 }
40968
40969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
40970         LDKChannelManager this_arg_conv;
40971         this_arg_conv.inner = untag_ptr(this_arg);
40972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40974         this_arg_conv.is_owned = false;
40975         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
40976         int64_t ret_ref = 0;
40977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40979         return ret_ref;
40980 }
40981
40982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
40983         LDKChannelManager this_arg_conv;
40984         this_arg_conv.inner = untag_ptr(this_arg);
40985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40987         this_arg_conv.is_owned = false;
40988         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
40989         int64_t ret_ref = 0;
40990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40992         return ret_ref;
40993 }
40994
40995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
40996         LDKChannelManager this_arg_conv;
40997         this_arg_conv.inner = untag_ptr(this_arg);
40998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41000         this_arg_conv.is_owned = false;
41001         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
41002         int64_t ret_ref = 0;
41003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41005         return ret_ref;
41006 }
41007
41008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41009         LDKChannelManager this_arg_conv;
41010         this_arg_conv.inner = untag_ptr(this_arg);
41011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41013         this_arg_conv.is_owned = false;
41014         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
41015         int64_t ret_ref = 0;
41016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41018         return ret_ref;
41019 }
41020
41021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41022         LDKChannelManager this_arg_conv;
41023         this_arg_conv.inner = untag_ptr(this_arg);
41024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41026         this_arg_conv.is_owned = false;
41027         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
41028         int64_t ret_ref = 0;
41029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41031         return ret_ref;
41032 }
41033
41034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41035         LDKChannelManager this_arg_conv;
41036         this_arg_conv.inner = untag_ptr(this_arg);
41037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41039         this_arg_conv.is_owned = false;
41040         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
41041         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
41042         return tag_ptr(ret_ret, true);
41043 }
41044
41045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
41046         LDKUserConfig config_conv;
41047         config_conv.inner = untag_ptr(config);
41048         config_conv.is_owned = ptr_is_owned(config);
41049         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41050         config_conv.is_owned = false;
41051         LDKInitFeatures ret_var = provided_init_features(&config_conv);
41052         int64_t ret_ref = 0;
41053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41055         return ret_ref;
41056 }
41057
41058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41059         LDKCounterpartyForwardingInfo obj_conv;
41060         obj_conv.inner = untag_ptr(obj);
41061         obj_conv.is_owned = ptr_is_owned(obj);
41062         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41063         obj_conv.is_owned = false;
41064         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
41065         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41066         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41067         CVec_u8Z_free(ret_var);
41068         return ret_arr;
41069 }
41070
41071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41072         LDKu8slice ser_ref;
41073         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41074         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41075         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
41076         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
41077         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41078         return tag_ptr(ret_conv, true);
41079 }
41080
41081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
41082         LDKChannelCounterparty obj_conv;
41083         obj_conv.inner = untag_ptr(obj);
41084         obj_conv.is_owned = ptr_is_owned(obj);
41085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41086         obj_conv.is_owned = false;
41087         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
41088         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41089         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41090         CVec_u8Z_free(ret_var);
41091         return ret_arr;
41092 }
41093
41094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41095         LDKu8slice ser_ref;
41096         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41097         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41098         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
41099         *ret_conv = ChannelCounterparty_read(ser_ref);
41100         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41101         return tag_ptr(ret_conv, true);
41102 }
41103
41104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
41105         LDKChannelDetails obj_conv;
41106         obj_conv.inner = untag_ptr(obj);
41107         obj_conv.is_owned = ptr_is_owned(obj);
41108         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41109         obj_conv.is_owned = false;
41110         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
41111         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41112         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41113         CVec_u8Z_free(ret_var);
41114         return ret_arr;
41115 }
41116
41117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41118         LDKu8slice ser_ref;
41119         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41120         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41121         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
41122         *ret_conv = ChannelDetails_read(ser_ref);
41123         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41124         return tag_ptr(ret_conv, true);
41125 }
41126
41127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
41128         LDKPhantomRouteHints obj_conv;
41129         obj_conv.inner = untag_ptr(obj);
41130         obj_conv.is_owned = ptr_is_owned(obj);
41131         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41132         obj_conv.is_owned = false;
41133         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
41134         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41135         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41136         CVec_u8Z_free(ret_var);
41137         return ret_arr;
41138 }
41139
41140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41141         LDKu8slice ser_ref;
41142         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41143         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41144         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
41145         *ret_conv = PhantomRouteHints_read(ser_ref);
41146         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41147         return tag_ptr(ret_conv, true);
41148 }
41149
41150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
41151         LDKChannelManager obj_conv;
41152         obj_conv.inner = untag_ptr(obj);
41153         obj_conv.is_owned = ptr_is_owned(obj);
41154         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41155         obj_conv.is_owned = false;
41156         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
41157         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41158         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41159         CVec_u8Z_free(ret_var);
41160         return ret_arr;
41161 }
41162
41163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
41164         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
41165         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
41166         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41167         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41168         CVec_u8Z_free(ret_var);
41169         return ret_arr;
41170 }
41171
41172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41173         LDKu8slice ser_ref;
41174         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41175         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41176         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
41177         *ret_conv = ChannelShutdownState_read(ser_ref);
41178         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41179         return tag_ptr(ret_conv, true);
41180 }
41181
41182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41183         LDKChannelManagerReadArgs this_obj_conv;
41184         this_obj_conv.inner = untag_ptr(this_obj);
41185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41187         ChannelManagerReadArgs_free(this_obj_conv);
41188 }
41189
41190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
41191         LDKChannelManagerReadArgs this_ptr_conv;
41192         this_ptr_conv.inner = untag_ptr(this_ptr);
41193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41195         this_ptr_conv.is_owned = false;
41196         // WARNING: This object doesn't live past this scope, needs clone!
41197         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
41198         return ret_ret;
41199 }
41200
41201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41202         LDKChannelManagerReadArgs this_ptr_conv;
41203         this_ptr_conv.inner = untag_ptr(this_ptr);
41204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41206         this_ptr_conv.is_owned = false;
41207         void* val_ptr = untag_ptr(val);
41208         CHECK_ACCESS(val_ptr);
41209         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
41210         if (val_conv.free == LDKEntropySource_JCalls_free) {
41211                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41212                 LDKEntropySource_JCalls_cloned(&val_conv);
41213         }
41214         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
41215 }
41216
41217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
41218         LDKChannelManagerReadArgs this_ptr_conv;
41219         this_ptr_conv.inner = untag_ptr(this_ptr);
41220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41222         this_ptr_conv.is_owned = false;
41223         // WARNING: This object doesn't live past this scope, needs clone!
41224         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
41225         return ret_ret;
41226 }
41227
41228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41229         LDKChannelManagerReadArgs this_ptr_conv;
41230         this_ptr_conv.inner = untag_ptr(this_ptr);
41231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41233         this_ptr_conv.is_owned = false;
41234         void* val_ptr = untag_ptr(val);
41235         CHECK_ACCESS(val_ptr);
41236         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
41237         if (val_conv.free == LDKNodeSigner_JCalls_free) {
41238                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41239                 LDKNodeSigner_JCalls_cloned(&val_conv);
41240         }
41241         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
41242 }
41243
41244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
41245         LDKChannelManagerReadArgs this_ptr_conv;
41246         this_ptr_conv.inner = untag_ptr(this_ptr);
41247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41249         this_ptr_conv.is_owned = false;
41250         // WARNING: This object doesn't live past this scope, needs clone!
41251         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
41252         return ret_ret;
41253 }
41254
41255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41256         LDKChannelManagerReadArgs this_ptr_conv;
41257         this_ptr_conv.inner = untag_ptr(this_ptr);
41258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41260         this_ptr_conv.is_owned = false;
41261         void* val_ptr = untag_ptr(val);
41262         CHECK_ACCESS(val_ptr);
41263         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
41264         if (val_conv.free == LDKSignerProvider_JCalls_free) {
41265                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41266                 LDKSignerProvider_JCalls_cloned(&val_conv);
41267         }
41268         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
41269 }
41270
41271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
41272         LDKChannelManagerReadArgs this_ptr_conv;
41273         this_ptr_conv.inner = untag_ptr(this_ptr);
41274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41276         this_ptr_conv.is_owned = false;
41277         // WARNING: This object doesn't live past this scope, needs clone!
41278         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
41279         return ret_ret;
41280 }
41281
41282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41283         LDKChannelManagerReadArgs this_ptr_conv;
41284         this_ptr_conv.inner = untag_ptr(this_ptr);
41285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41287         this_ptr_conv.is_owned = false;
41288         void* val_ptr = untag_ptr(val);
41289         CHECK_ACCESS(val_ptr);
41290         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
41291         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
41292                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41293                 LDKFeeEstimator_JCalls_cloned(&val_conv);
41294         }
41295         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
41296 }
41297
41298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
41299         LDKChannelManagerReadArgs this_ptr_conv;
41300         this_ptr_conv.inner = untag_ptr(this_ptr);
41301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41303         this_ptr_conv.is_owned = false;
41304         // WARNING: This object doesn't live past this scope, needs clone!
41305         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
41306         return ret_ret;
41307 }
41308
41309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41310         LDKChannelManagerReadArgs this_ptr_conv;
41311         this_ptr_conv.inner = untag_ptr(this_ptr);
41312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41314         this_ptr_conv.is_owned = false;
41315         void* val_ptr = untag_ptr(val);
41316         CHECK_ACCESS(val_ptr);
41317         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
41318         if (val_conv.free == LDKWatch_JCalls_free) {
41319                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41320                 LDKWatch_JCalls_cloned(&val_conv);
41321         }
41322         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
41323 }
41324
41325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
41326         LDKChannelManagerReadArgs this_ptr_conv;
41327         this_ptr_conv.inner = untag_ptr(this_ptr);
41328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41330         this_ptr_conv.is_owned = false;
41331         // WARNING: This object doesn't live past this scope, needs clone!
41332         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
41333         return ret_ret;
41334 }
41335
41336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41337         LDKChannelManagerReadArgs this_ptr_conv;
41338         this_ptr_conv.inner = untag_ptr(this_ptr);
41339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41341         this_ptr_conv.is_owned = false;
41342         void* val_ptr = untag_ptr(val);
41343         CHECK_ACCESS(val_ptr);
41344         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
41345         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
41346                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41347                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
41348         }
41349         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
41350 }
41351
41352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
41353         LDKChannelManagerReadArgs this_ptr_conv;
41354         this_ptr_conv.inner = untag_ptr(this_ptr);
41355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41357         this_ptr_conv.is_owned = false;
41358         // WARNING: This object doesn't live past this scope, needs clone!
41359         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
41360         return ret_ret;
41361 }
41362
41363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41364         LDKChannelManagerReadArgs this_ptr_conv;
41365         this_ptr_conv.inner = untag_ptr(this_ptr);
41366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41368         this_ptr_conv.is_owned = false;
41369         void* val_ptr = untag_ptr(val);
41370         CHECK_ACCESS(val_ptr);
41371         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
41372         if (val_conv.free == LDKRouter_JCalls_free) {
41373                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41374                 LDKRouter_JCalls_cloned(&val_conv);
41375         }
41376         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
41377 }
41378
41379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
41380         LDKChannelManagerReadArgs this_ptr_conv;
41381         this_ptr_conv.inner = untag_ptr(this_ptr);
41382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41384         this_ptr_conv.is_owned = false;
41385         // WARNING: This object doesn't live past this scope, needs clone!
41386         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
41387         return ret_ret;
41388 }
41389
41390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41391         LDKChannelManagerReadArgs this_ptr_conv;
41392         this_ptr_conv.inner = untag_ptr(this_ptr);
41393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41395         this_ptr_conv.is_owned = false;
41396         void* val_ptr = untag_ptr(val);
41397         CHECK_ACCESS(val_ptr);
41398         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
41399         if (val_conv.free == LDKLogger_JCalls_free) {
41400                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41401                 LDKLogger_JCalls_cloned(&val_conv);
41402         }
41403         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
41404 }
41405
41406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
41407         LDKChannelManagerReadArgs this_ptr_conv;
41408         this_ptr_conv.inner = untag_ptr(this_ptr);
41409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41411         this_ptr_conv.is_owned = false;
41412         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
41413         int64_t ret_ref = 0;
41414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41416         return ret_ref;
41417 }
41418
41419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41420         LDKChannelManagerReadArgs this_ptr_conv;
41421         this_ptr_conv.inner = untag_ptr(this_ptr);
41422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41424         this_ptr_conv.is_owned = false;
41425         LDKUserConfig val_conv;
41426         val_conv.inner = untag_ptr(val);
41427         val_conv.is_owned = ptr_is_owned(val);
41428         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41429         val_conv = UserConfig_clone(&val_conv);
41430         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
41431 }
41432
41433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t default_config, int64_tArray channel_monitors) {
41434         void* entropy_source_ptr = untag_ptr(entropy_source);
41435         CHECK_ACCESS(entropy_source_ptr);
41436         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41437         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41438                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41439                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41440         }
41441         void* node_signer_ptr = untag_ptr(node_signer);
41442         CHECK_ACCESS(node_signer_ptr);
41443         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
41444         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
41445                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41446                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
41447         }
41448         void* signer_provider_ptr = untag_ptr(signer_provider);
41449         CHECK_ACCESS(signer_provider_ptr);
41450         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41451         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41452                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41453                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41454         }
41455         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41456         CHECK_ACCESS(fee_estimator_ptr);
41457         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41458         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41459                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41460                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41461         }
41462         void* chain_monitor_ptr = untag_ptr(chain_monitor);
41463         CHECK_ACCESS(chain_monitor_ptr);
41464         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
41465         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
41466                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41467                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
41468         }
41469         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
41470         CHECK_ACCESS(tx_broadcaster_ptr);
41471         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
41472         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41473                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41474                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
41475         }
41476         void* router_ptr = untag_ptr(router);
41477         CHECK_ACCESS(router_ptr);
41478         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
41479         if (router_conv.free == LDKRouter_JCalls_free) {
41480                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41481                 LDKRouter_JCalls_cloned(&router_conv);
41482         }
41483         void* logger_ptr = untag_ptr(logger);
41484         CHECK_ACCESS(logger_ptr);
41485         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41486         if (logger_conv.free == LDKLogger_JCalls_free) {
41487                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41488                 LDKLogger_JCalls_cloned(&logger_conv);
41489         }
41490         LDKUserConfig default_config_conv;
41491         default_config_conv.inner = untag_ptr(default_config);
41492         default_config_conv.is_owned = ptr_is_owned(default_config);
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
41494         default_config_conv = UserConfig_clone(&default_config_conv);
41495         LDKCVec_ChannelMonitorZ channel_monitors_constr;
41496         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
41497         if (channel_monitors_constr.datalen > 0)
41498                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
41499         else
41500                 channel_monitors_constr.data = NULL;
41501         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
41502         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
41503                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
41504                 LDKChannelMonitor channel_monitors_conv_16_conv;
41505                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
41506                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
41507                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
41508                 channel_monitors_conv_16_conv.is_owned = false;
41509                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
41510         }
41511         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
41512         LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(entropy_source_conv, node_signer_conv, signer_provider_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, default_config_conv, channel_monitors_constr);
41513         int64_t ret_ref = 0;
41514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41516         return ret_ref;
41517 }
41518
41519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
41520         LDKu8slice ser_ref;
41521         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41522         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41523         LDKChannelManagerReadArgs arg_conv;
41524         arg_conv.inner = untag_ptr(arg);
41525         arg_conv.is_owned = ptr_is_owned(arg);
41526         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41527         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
41528         
41529         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
41530         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
41531         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41532         return tag_ptr(ret_conv, true);
41533 }
41534
41535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41536         LDKExpandedKey this_obj_conv;
41537         this_obj_conv.inner = untag_ptr(this_obj);
41538         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41540         ExpandedKey_free(this_obj_conv);
41541 }
41542
41543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
41544         uint8_t key_material_arr[32];
41545         CHECK((*env)->GetArrayLength(env, key_material) == 32);
41546         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
41547         uint8_t (*key_material_ref)[32] = &key_material_arr;
41548         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
41549         int64_t ret_ref = 0;
41550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41552         return ret_ref;
41553 }
41554
41555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t entropy_source, int64_t current_time, int64_t min_final_cltv_expiry_delta) {
41556         LDKExpandedKey keys_conv;
41557         keys_conv.inner = untag_ptr(keys);
41558         keys_conv.is_owned = ptr_is_owned(keys);
41559         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
41560         keys_conv.is_owned = false;
41561         void* min_value_msat_ptr = untag_ptr(min_value_msat);
41562         CHECK_ACCESS(min_value_msat_ptr);
41563         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
41564         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
41565         void* entropy_source_ptr = untag_ptr(entropy_source);
41566         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
41567         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
41568         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
41569         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
41570         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
41571         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
41572         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
41573         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
41574         return tag_ptr(ret_conv, true);
41575 }
41576
41577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time, int64_t min_final_cltv_expiry_delta) {
41578         LDKExpandedKey keys_conv;
41579         keys_conv.inner = untag_ptr(keys);
41580         keys_conv.is_owned = ptr_is_owned(keys);
41581         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
41582         keys_conv.is_owned = false;
41583         void* min_value_msat_ptr = untag_ptr(min_value_msat);
41584         CHECK_ACCESS(min_value_msat_ptr);
41585         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
41586         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
41587         LDKThirtyTwoBytes payment_hash_ref;
41588         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41589         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
41590         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
41591         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
41592         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
41593         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
41594         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
41595         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta_conv);
41596         return tag_ptr(ret_conv, true);
41597 }
41598
41599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41600         if (!ptr_is_owned(this_ptr)) return;
41601         void* this_ptr_ptr = untag_ptr(this_ptr);
41602         CHECK_ACCESS(this_ptr_ptr);
41603         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
41604         FREE(untag_ptr(this_ptr));
41605         DecodeError_free(this_ptr_conv);
41606 }
41607
41608 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
41609         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41610         *ret_copy = DecodeError_clone(arg);
41611         int64_t ret_ref = tag_ptr(ret_copy, true);
41612         return ret_ref;
41613 }
41614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41615         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
41616         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
41617         return ret_conv;
41618 }
41619
41620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41621         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
41622         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41623         *ret_copy = DecodeError_clone(orig_conv);
41624         int64_t ret_ref = tag_ptr(ret_copy, true);
41625         return ret_ref;
41626 }
41627
41628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
41629         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41630         *ret_copy = DecodeError_unknown_version();
41631         int64_t ret_ref = tag_ptr(ret_copy, true);
41632         return ret_ref;
41633 }
41634
41635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
41636         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41637         *ret_copy = DecodeError_unknown_required_feature();
41638         int64_t ret_ref = tag_ptr(ret_copy, true);
41639         return ret_ref;
41640 }
41641
41642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
41643         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41644         *ret_copy = DecodeError_invalid_value();
41645         int64_t ret_ref = tag_ptr(ret_copy, true);
41646         return ret_ref;
41647 }
41648
41649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
41650         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41651         *ret_copy = DecodeError_short_read();
41652         int64_t ret_ref = tag_ptr(ret_copy, true);
41653         return ret_ref;
41654 }
41655
41656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
41657         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41658         *ret_copy = DecodeError_bad_length_descriptor();
41659         int64_t ret_ref = tag_ptr(ret_copy, true);
41660         return ret_ref;
41661 }
41662
41663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
41664         LDKIOError a_conv = LDKIOError_from_java(env, a);
41665         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41666         *ret_copy = DecodeError_io(a_conv);
41667         int64_t ret_ref = tag_ptr(ret_copy, true);
41668         return ret_ref;
41669 }
41670
41671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
41672         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41673         *ret_copy = DecodeError_unsupported_compression();
41674         int64_t ret_ref = tag_ptr(ret_copy, true);
41675         return ret_ref;
41676 }
41677
41678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41679         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
41680         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
41681         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
41682         return ret_conv;
41683 }
41684
41685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41686         LDKInit this_obj_conv;
41687         this_obj_conv.inner = untag_ptr(this_obj);
41688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41690         Init_free(this_obj_conv);
41691 }
41692
41693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41694         LDKInit this_ptr_conv;
41695         this_ptr_conv.inner = untag_ptr(this_ptr);
41696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41698         this_ptr_conv.is_owned = false;
41699         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
41700         int64_t ret_ref = 0;
41701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41703         return ret_ref;
41704 }
41705
41706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41707         LDKInit this_ptr_conv;
41708         this_ptr_conv.inner = untag_ptr(this_ptr);
41709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41711         this_ptr_conv.is_owned = false;
41712         LDKInitFeatures val_conv;
41713         val_conv.inner = untag_ptr(val);
41714         val_conv.is_owned = ptr_is_owned(val);
41715         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41716         val_conv = InitFeatures_clone(&val_conv);
41717         Init_set_features(&this_ptr_conv, val_conv);
41718 }
41719
41720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
41721         LDKInit this_ptr_conv;
41722         this_ptr_conv.inner = untag_ptr(this_ptr);
41723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41725         this_ptr_conv.is_owned = false;
41726         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
41727         *ret_copy = Init_get_networks(&this_ptr_conv);
41728         int64_t ret_ref = tag_ptr(ret_copy, true);
41729         return ret_ref;
41730 }
41731
41732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41733         LDKInit this_ptr_conv;
41734         this_ptr_conv.inner = untag_ptr(this_ptr);
41735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41737         this_ptr_conv.is_owned = false;
41738         void* val_ptr = untag_ptr(val);
41739         CHECK_ACCESS(val_ptr);
41740         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
41741         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
41742         Init_set_networks(&this_ptr_conv, val_conv);
41743 }
41744
41745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
41746         LDKInit this_ptr_conv;
41747         this_ptr_conv.inner = untag_ptr(this_ptr);
41748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41750         this_ptr_conv.is_owned = false;
41751         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
41752         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
41753         int64_t ret_ref = tag_ptr(ret_copy, true);
41754         return ret_ref;
41755 }
41756
41757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41758         LDKInit this_ptr_conv;
41759         this_ptr_conv.inner = untag_ptr(this_ptr);
41760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41762         this_ptr_conv.is_owned = false;
41763         void* val_ptr = untag_ptr(val);
41764         CHECK_ACCESS(val_ptr);
41765         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
41766         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
41767         Init_set_remote_network_address(&this_ptr_conv, val_conv);
41768 }
41769
41770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t networks_arg, int64_t remote_network_address_arg) {
41771         LDKInitFeatures features_arg_conv;
41772         features_arg_conv.inner = untag_ptr(features_arg);
41773         features_arg_conv.is_owned = ptr_is_owned(features_arg);
41774         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41775         features_arg_conv = InitFeatures_clone(&features_arg_conv);
41776         void* networks_arg_ptr = untag_ptr(networks_arg);
41777         CHECK_ACCESS(networks_arg_ptr);
41778         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
41779         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
41780         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
41781         CHECK_ACCESS(remote_network_address_arg_ptr);
41782         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
41783         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
41784         int64_t ret_ref = 0;
41785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41787         return ret_ref;
41788 }
41789
41790 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
41791         LDKInit ret_var = Init_clone(arg);
41792         int64_t ret_ref = 0;
41793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41795         return ret_ref;
41796 }
41797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41798         LDKInit arg_conv;
41799         arg_conv.inner = untag_ptr(arg);
41800         arg_conv.is_owned = ptr_is_owned(arg);
41801         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41802         arg_conv.is_owned = false;
41803         int64_t ret_conv = Init_clone_ptr(&arg_conv);
41804         return ret_conv;
41805 }
41806
41807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41808         LDKInit orig_conv;
41809         orig_conv.inner = untag_ptr(orig);
41810         orig_conv.is_owned = ptr_is_owned(orig);
41811         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41812         orig_conv.is_owned = false;
41813         LDKInit ret_var = Init_clone(&orig_conv);
41814         int64_t ret_ref = 0;
41815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41817         return ret_ref;
41818 }
41819
41820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41821         LDKInit a_conv;
41822         a_conv.inner = untag_ptr(a);
41823         a_conv.is_owned = ptr_is_owned(a);
41824         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41825         a_conv.is_owned = false;
41826         LDKInit b_conv;
41827         b_conv.inner = untag_ptr(b);
41828         b_conv.is_owned = ptr_is_owned(b);
41829         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41830         b_conv.is_owned = false;
41831         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
41832         return ret_conv;
41833 }
41834
41835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41836         LDKErrorMessage this_obj_conv;
41837         this_obj_conv.inner = untag_ptr(this_obj);
41838         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41840         ErrorMessage_free(this_obj_conv);
41841 }
41842
41843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41844         LDKErrorMessage this_ptr_conv;
41845         this_ptr_conv.inner = untag_ptr(this_ptr);
41846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41848         this_ptr_conv.is_owned = false;
41849         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41850         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
41851         return ret_arr;
41852 }
41853
41854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41855         LDKErrorMessage this_ptr_conv;
41856         this_ptr_conv.inner = untag_ptr(this_ptr);
41857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41859         this_ptr_conv.is_owned = false;
41860         LDKThirtyTwoBytes val_ref;
41861         CHECK((*env)->GetArrayLength(env, val) == 32);
41862         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41863         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
41864 }
41865
41866 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
41867         LDKErrorMessage this_ptr_conv;
41868         this_ptr_conv.inner = untag_ptr(this_ptr);
41869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41871         this_ptr_conv.is_owned = false;
41872         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
41873         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41874         Str_free(ret_str);
41875         return ret_conv;
41876 }
41877
41878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41879         LDKErrorMessage this_ptr_conv;
41880         this_ptr_conv.inner = untag_ptr(this_ptr);
41881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41883         this_ptr_conv.is_owned = false;
41884         LDKStr val_conv = java_to_owned_str(env, val);
41885         ErrorMessage_set_data(&this_ptr_conv, val_conv);
41886 }
41887
41888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
41889         LDKThirtyTwoBytes channel_id_arg_ref;
41890         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
41891         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
41892         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
41893         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
41894         int64_t ret_ref = 0;
41895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41897         return ret_ref;
41898 }
41899
41900 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
41901         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
41902         int64_t ret_ref = 0;
41903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41905         return ret_ref;
41906 }
41907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41908         LDKErrorMessage arg_conv;
41909         arg_conv.inner = untag_ptr(arg);
41910         arg_conv.is_owned = ptr_is_owned(arg);
41911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41912         arg_conv.is_owned = false;
41913         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
41914         return ret_conv;
41915 }
41916
41917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41918         LDKErrorMessage orig_conv;
41919         orig_conv.inner = untag_ptr(orig);
41920         orig_conv.is_owned = ptr_is_owned(orig);
41921         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41922         orig_conv.is_owned = false;
41923         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
41924         int64_t ret_ref = 0;
41925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41927         return ret_ref;
41928 }
41929
41930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41931         LDKErrorMessage a_conv;
41932         a_conv.inner = untag_ptr(a);
41933         a_conv.is_owned = ptr_is_owned(a);
41934         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41935         a_conv.is_owned = false;
41936         LDKErrorMessage b_conv;
41937         b_conv.inner = untag_ptr(b);
41938         b_conv.is_owned = ptr_is_owned(b);
41939         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41940         b_conv.is_owned = false;
41941         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
41942         return ret_conv;
41943 }
41944
41945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41946         LDKWarningMessage this_obj_conv;
41947         this_obj_conv.inner = untag_ptr(this_obj);
41948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41950         WarningMessage_free(this_obj_conv);
41951 }
41952
41953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41954         LDKWarningMessage this_ptr_conv;
41955         this_ptr_conv.inner = untag_ptr(this_ptr);
41956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41958         this_ptr_conv.is_owned = false;
41959         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41960         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
41961         return ret_arr;
41962 }
41963
41964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41965         LDKWarningMessage this_ptr_conv;
41966         this_ptr_conv.inner = untag_ptr(this_ptr);
41967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41969         this_ptr_conv.is_owned = false;
41970         LDKThirtyTwoBytes val_ref;
41971         CHECK((*env)->GetArrayLength(env, val) == 32);
41972         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41973         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
41974 }
41975
41976 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
41977         LDKWarningMessage this_ptr_conv;
41978         this_ptr_conv.inner = untag_ptr(this_ptr);
41979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41981         this_ptr_conv.is_owned = false;
41982         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
41983         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41984         Str_free(ret_str);
41985         return ret_conv;
41986 }
41987
41988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41989         LDKWarningMessage this_ptr_conv;
41990         this_ptr_conv.inner = untag_ptr(this_ptr);
41991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41993         this_ptr_conv.is_owned = false;
41994         LDKStr val_conv = java_to_owned_str(env, val);
41995         WarningMessage_set_data(&this_ptr_conv, val_conv);
41996 }
41997
41998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
41999         LDKThirtyTwoBytes channel_id_arg_ref;
42000         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42001         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42002         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
42003         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
42004         int64_t ret_ref = 0;
42005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42007         return ret_ref;
42008 }
42009
42010 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
42011         LDKWarningMessage ret_var = WarningMessage_clone(arg);
42012         int64_t ret_ref = 0;
42013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42015         return ret_ref;
42016 }
42017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42018         LDKWarningMessage arg_conv;
42019         arg_conv.inner = untag_ptr(arg);
42020         arg_conv.is_owned = ptr_is_owned(arg);
42021         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42022         arg_conv.is_owned = false;
42023         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
42024         return ret_conv;
42025 }
42026
42027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42028         LDKWarningMessage orig_conv;
42029         orig_conv.inner = untag_ptr(orig);
42030         orig_conv.is_owned = ptr_is_owned(orig);
42031         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42032         orig_conv.is_owned = false;
42033         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
42034         int64_t ret_ref = 0;
42035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42037         return ret_ref;
42038 }
42039
42040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42041         LDKWarningMessage a_conv;
42042         a_conv.inner = untag_ptr(a);
42043         a_conv.is_owned = ptr_is_owned(a);
42044         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42045         a_conv.is_owned = false;
42046         LDKWarningMessage b_conv;
42047         b_conv.inner = untag_ptr(b);
42048         b_conv.is_owned = ptr_is_owned(b);
42049         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42050         b_conv.is_owned = false;
42051         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
42052         return ret_conv;
42053 }
42054
42055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42056         LDKPing this_obj_conv;
42057         this_obj_conv.inner = untag_ptr(this_obj);
42058         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42060         Ping_free(this_obj_conv);
42061 }
42062
42063 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42064         LDKPing this_ptr_conv;
42065         this_ptr_conv.inner = untag_ptr(this_ptr);
42066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42068         this_ptr_conv.is_owned = false;
42069         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
42070         return ret_conv;
42071 }
42072
42073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42074         LDKPing this_ptr_conv;
42075         this_ptr_conv.inner = untag_ptr(this_ptr);
42076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42078         this_ptr_conv.is_owned = false;
42079         Ping_set_ponglen(&this_ptr_conv, val);
42080 }
42081
42082 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42083         LDKPing this_ptr_conv;
42084         this_ptr_conv.inner = untag_ptr(this_ptr);
42085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42087         this_ptr_conv.is_owned = false;
42088         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
42089         return ret_conv;
42090 }
42091
42092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42093         LDKPing this_ptr_conv;
42094         this_ptr_conv.inner = untag_ptr(this_ptr);
42095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42097         this_ptr_conv.is_owned = false;
42098         Ping_set_byteslen(&this_ptr_conv, val);
42099 }
42100
42101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
42102         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
42103         int64_t ret_ref = 0;
42104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42106         return ret_ref;
42107 }
42108
42109 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
42110         LDKPing ret_var = Ping_clone(arg);
42111         int64_t ret_ref = 0;
42112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42114         return ret_ref;
42115 }
42116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42117         LDKPing arg_conv;
42118         arg_conv.inner = untag_ptr(arg);
42119         arg_conv.is_owned = ptr_is_owned(arg);
42120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42121         arg_conv.is_owned = false;
42122         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
42123         return ret_conv;
42124 }
42125
42126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42127         LDKPing orig_conv;
42128         orig_conv.inner = untag_ptr(orig);
42129         orig_conv.is_owned = ptr_is_owned(orig);
42130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42131         orig_conv.is_owned = false;
42132         LDKPing ret_var = Ping_clone(&orig_conv);
42133         int64_t ret_ref = 0;
42134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42136         return ret_ref;
42137 }
42138
42139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42140         LDKPing a_conv;
42141         a_conv.inner = untag_ptr(a);
42142         a_conv.is_owned = ptr_is_owned(a);
42143         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42144         a_conv.is_owned = false;
42145         LDKPing b_conv;
42146         b_conv.inner = untag_ptr(b);
42147         b_conv.is_owned = ptr_is_owned(b);
42148         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42149         b_conv.is_owned = false;
42150         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
42151         return ret_conv;
42152 }
42153
42154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42155         LDKPong this_obj_conv;
42156         this_obj_conv.inner = untag_ptr(this_obj);
42157         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42159         Pong_free(this_obj_conv);
42160 }
42161
42162 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42163         LDKPong this_ptr_conv;
42164         this_ptr_conv.inner = untag_ptr(this_ptr);
42165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42167         this_ptr_conv.is_owned = false;
42168         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
42169         return ret_conv;
42170 }
42171
42172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42173         LDKPong this_ptr_conv;
42174         this_ptr_conv.inner = untag_ptr(this_ptr);
42175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42177         this_ptr_conv.is_owned = false;
42178         Pong_set_byteslen(&this_ptr_conv, val);
42179 }
42180
42181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
42182         LDKPong ret_var = Pong_new(byteslen_arg);
42183         int64_t ret_ref = 0;
42184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42186         return ret_ref;
42187 }
42188
42189 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
42190         LDKPong ret_var = Pong_clone(arg);
42191         int64_t ret_ref = 0;
42192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42194         return ret_ref;
42195 }
42196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42197         LDKPong arg_conv;
42198         arg_conv.inner = untag_ptr(arg);
42199         arg_conv.is_owned = ptr_is_owned(arg);
42200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42201         arg_conv.is_owned = false;
42202         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
42203         return ret_conv;
42204 }
42205
42206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42207         LDKPong orig_conv;
42208         orig_conv.inner = untag_ptr(orig);
42209         orig_conv.is_owned = ptr_is_owned(orig);
42210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42211         orig_conv.is_owned = false;
42212         LDKPong ret_var = Pong_clone(&orig_conv);
42213         int64_t ret_ref = 0;
42214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42216         return ret_ref;
42217 }
42218
42219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42220         LDKPong a_conv;
42221         a_conv.inner = untag_ptr(a);
42222         a_conv.is_owned = ptr_is_owned(a);
42223         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42224         a_conv.is_owned = false;
42225         LDKPong b_conv;
42226         b_conv.inner = untag_ptr(b);
42227         b_conv.is_owned = ptr_is_owned(b);
42228         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42229         b_conv.is_owned = false;
42230         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
42231         return ret_conv;
42232 }
42233
42234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42235         LDKOpenChannel this_obj_conv;
42236         this_obj_conv.inner = untag_ptr(this_obj);
42237         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42239         OpenChannel_free(this_obj_conv);
42240 }
42241
42242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
42243         LDKOpenChannel this_ptr_conv;
42244         this_ptr_conv.inner = untag_ptr(this_ptr);
42245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42247         this_ptr_conv.is_owned = false;
42248         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42249         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
42250         return ret_arr;
42251 }
42252
42253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42254         LDKOpenChannel this_ptr_conv;
42255         this_ptr_conv.inner = untag_ptr(this_ptr);
42256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42258         this_ptr_conv.is_owned = false;
42259         LDKThirtyTwoBytes val_ref;
42260         CHECK((*env)->GetArrayLength(env, val) == 32);
42261         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42262         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
42263 }
42264
42265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42266         LDKOpenChannel this_ptr_conv;
42267         this_ptr_conv.inner = untag_ptr(this_ptr);
42268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42270         this_ptr_conv.is_owned = false;
42271         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42272         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
42273         return ret_arr;
42274 }
42275
42276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42277         LDKOpenChannel this_ptr_conv;
42278         this_ptr_conv.inner = untag_ptr(this_ptr);
42279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42281         this_ptr_conv.is_owned = false;
42282         LDKThirtyTwoBytes val_ref;
42283         CHECK((*env)->GetArrayLength(env, val) == 32);
42284         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42285         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
42286 }
42287
42288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42289         LDKOpenChannel this_ptr_conv;
42290         this_ptr_conv.inner = untag_ptr(this_ptr);
42291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42293         this_ptr_conv.is_owned = false;
42294         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
42295         return ret_conv;
42296 }
42297
42298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42299         LDKOpenChannel this_ptr_conv;
42300         this_ptr_conv.inner = untag_ptr(this_ptr);
42301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42303         this_ptr_conv.is_owned = false;
42304         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
42305 }
42306
42307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42308         LDKOpenChannel this_ptr_conv;
42309         this_ptr_conv.inner = untag_ptr(this_ptr);
42310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42312         this_ptr_conv.is_owned = false;
42313         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
42314         return ret_conv;
42315 }
42316
42317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42318         LDKOpenChannel this_ptr_conv;
42319         this_ptr_conv.inner = untag_ptr(this_ptr);
42320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42322         this_ptr_conv.is_owned = false;
42323         OpenChannel_set_push_msat(&this_ptr_conv, val);
42324 }
42325
42326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42327         LDKOpenChannel this_ptr_conv;
42328         this_ptr_conv.inner = untag_ptr(this_ptr);
42329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42331         this_ptr_conv.is_owned = false;
42332         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
42333         return ret_conv;
42334 }
42335
42336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42337         LDKOpenChannel this_ptr_conv;
42338         this_ptr_conv.inner = untag_ptr(this_ptr);
42339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42341         this_ptr_conv.is_owned = false;
42342         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
42343 }
42344
42345 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) {
42346         LDKOpenChannel this_ptr_conv;
42347         this_ptr_conv.inner = untag_ptr(this_ptr);
42348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42350         this_ptr_conv.is_owned = false;
42351         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42352         return ret_conv;
42353 }
42354
42355 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) {
42356         LDKOpenChannel this_ptr_conv;
42357         this_ptr_conv.inner = untag_ptr(this_ptr);
42358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42360         this_ptr_conv.is_owned = false;
42361         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42362 }
42363
42364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42365         LDKOpenChannel this_ptr_conv;
42366         this_ptr_conv.inner = untag_ptr(this_ptr);
42367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42369         this_ptr_conv.is_owned = false;
42370         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
42371         return ret_conv;
42372 }
42373
42374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42375         LDKOpenChannel this_ptr_conv;
42376         this_ptr_conv.inner = untag_ptr(this_ptr);
42377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42379         this_ptr_conv.is_owned = false;
42380         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
42381 }
42382
42383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42384         LDKOpenChannel this_ptr_conv;
42385         this_ptr_conv.inner = untag_ptr(this_ptr);
42386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42388         this_ptr_conv.is_owned = false;
42389         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
42390         return ret_conv;
42391 }
42392
42393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42394         LDKOpenChannel this_ptr_conv;
42395         this_ptr_conv.inner = untag_ptr(this_ptr);
42396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42398         this_ptr_conv.is_owned = false;
42399         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
42400 }
42401
42402 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
42403         LDKOpenChannel this_ptr_conv;
42404         this_ptr_conv.inner = untag_ptr(this_ptr);
42405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42407         this_ptr_conv.is_owned = false;
42408         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
42409         return ret_conv;
42410 }
42411
42412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42413         LDKOpenChannel this_ptr_conv;
42414         this_ptr_conv.inner = untag_ptr(this_ptr);
42415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42417         this_ptr_conv.is_owned = false;
42418         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
42419 }
42420
42421 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
42422         LDKOpenChannel this_ptr_conv;
42423         this_ptr_conv.inner = untag_ptr(this_ptr);
42424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42426         this_ptr_conv.is_owned = false;
42427         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
42428         return ret_conv;
42429 }
42430
42431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42432         LDKOpenChannel this_ptr_conv;
42433         this_ptr_conv.inner = untag_ptr(this_ptr);
42434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42436         this_ptr_conv.is_owned = false;
42437         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
42438 }
42439
42440 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
42441         LDKOpenChannel this_ptr_conv;
42442         this_ptr_conv.inner = untag_ptr(this_ptr);
42443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42445         this_ptr_conv.is_owned = false;
42446         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
42447         return ret_conv;
42448 }
42449
42450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42451         LDKOpenChannel this_ptr_conv;
42452         this_ptr_conv.inner = untag_ptr(this_ptr);
42453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42455         this_ptr_conv.is_owned = false;
42456         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
42457 }
42458
42459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42460         LDKOpenChannel this_ptr_conv;
42461         this_ptr_conv.inner = untag_ptr(this_ptr);
42462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42464         this_ptr_conv.is_owned = false;
42465         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42466         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
42467         return ret_arr;
42468 }
42469
42470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42471         LDKOpenChannel this_ptr_conv;
42472         this_ptr_conv.inner = untag_ptr(this_ptr);
42473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42475         this_ptr_conv.is_owned = false;
42476         LDKPublicKey val_ref;
42477         CHECK((*env)->GetArrayLength(env, val) == 33);
42478         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42479         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
42480 }
42481
42482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42483         LDKOpenChannel this_ptr_conv;
42484         this_ptr_conv.inner = untag_ptr(this_ptr);
42485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42487         this_ptr_conv.is_owned = false;
42488         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42489         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
42490         return ret_arr;
42491 }
42492
42493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42494         LDKOpenChannel this_ptr_conv;
42495         this_ptr_conv.inner = untag_ptr(this_ptr);
42496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42498         this_ptr_conv.is_owned = false;
42499         LDKPublicKey val_ref;
42500         CHECK((*env)->GetArrayLength(env, val) == 33);
42501         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42502         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
42503 }
42504
42505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
42506         LDKOpenChannel this_ptr_conv;
42507         this_ptr_conv.inner = untag_ptr(this_ptr);
42508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42510         this_ptr_conv.is_owned = false;
42511         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42512         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
42513         return ret_arr;
42514 }
42515
42516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42517         LDKOpenChannel this_ptr_conv;
42518         this_ptr_conv.inner = untag_ptr(this_ptr);
42519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42521         this_ptr_conv.is_owned = false;
42522         LDKPublicKey val_ref;
42523         CHECK((*env)->GetArrayLength(env, val) == 33);
42524         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42525         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
42526 }
42527
42528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42529         LDKOpenChannel this_ptr_conv;
42530         this_ptr_conv.inner = untag_ptr(this_ptr);
42531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42533         this_ptr_conv.is_owned = false;
42534         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42535         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
42536         return ret_arr;
42537 }
42538
42539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42540         LDKOpenChannel this_ptr_conv;
42541         this_ptr_conv.inner = untag_ptr(this_ptr);
42542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42544         this_ptr_conv.is_owned = false;
42545         LDKPublicKey val_ref;
42546         CHECK((*env)->GetArrayLength(env, val) == 33);
42547         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42548         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42549 }
42550
42551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42552         LDKOpenChannel this_ptr_conv;
42553         this_ptr_conv.inner = untag_ptr(this_ptr);
42554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42556         this_ptr_conv.is_owned = false;
42557         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42558         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
42559         return ret_arr;
42560 }
42561
42562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42563         LDKOpenChannel this_ptr_conv;
42564         this_ptr_conv.inner = untag_ptr(this_ptr);
42565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42567         this_ptr_conv.is_owned = false;
42568         LDKPublicKey val_ref;
42569         CHECK((*env)->GetArrayLength(env, val) == 33);
42570         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42571         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
42572 }
42573
42574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
42575         LDKOpenChannel this_ptr_conv;
42576         this_ptr_conv.inner = untag_ptr(this_ptr);
42577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42579         this_ptr_conv.is_owned = false;
42580         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42581         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
42582         return ret_arr;
42583 }
42584
42585 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) {
42586         LDKOpenChannel this_ptr_conv;
42587         this_ptr_conv.inner = untag_ptr(this_ptr);
42588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42590         this_ptr_conv.is_owned = false;
42591         LDKPublicKey val_ref;
42592         CHECK((*env)->GetArrayLength(env, val) == 33);
42593         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42594         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
42595 }
42596
42597 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
42598         LDKOpenChannel this_ptr_conv;
42599         this_ptr_conv.inner = untag_ptr(this_ptr);
42600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42602         this_ptr_conv.is_owned = false;
42603         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
42604         return ret_conv;
42605 }
42606
42607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
42608         LDKOpenChannel this_ptr_conv;
42609         this_ptr_conv.inner = untag_ptr(this_ptr);
42610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42612         this_ptr_conv.is_owned = false;
42613         OpenChannel_set_channel_flags(&this_ptr_conv, val);
42614 }
42615
42616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42617         LDKOpenChannel this_ptr_conv;
42618         this_ptr_conv.inner = untag_ptr(this_ptr);
42619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42621         this_ptr_conv.is_owned = false;
42622         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42623         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
42624         int64_t ret_ref = tag_ptr(ret_copy, true);
42625         return ret_ref;
42626 }
42627
42628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42629         LDKOpenChannel this_ptr_conv;
42630         this_ptr_conv.inner = untag_ptr(this_ptr);
42631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42633         this_ptr_conv.is_owned = false;
42634         void* val_ptr = untag_ptr(val);
42635         CHECK_ACCESS(val_ptr);
42636         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42637         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42638         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42639 }
42640
42641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
42642         LDKOpenChannel this_ptr_conv;
42643         this_ptr_conv.inner = untag_ptr(this_ptr);
42644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42646         this_ptr_conv.is_owned = false;
42647         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
42648         int64_t ret_ref = 0;
42649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42651         return ret_ref;
42652 }
42653
42654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42655         LDKOpenChannel this_ptr_conv;
42656         this_ptr_conv.inner = untag_ptr(this_ptr);
42657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42659         this_ptr_conv.is_owned = false;
42660         LDKChannelTypeFeatures val_conv;
42661         val_conv.inner = untag_ptr(val);
42662         val_conv.is_owned = ptr_is_owned(val);
42663         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42664         val_conv = ChannelTypeFeatures_clone(&val_conv);
42665         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
42666 }
42667
42668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t push_msat_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t feerate_per_kw_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, 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, int8_tArray first_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
42669         LDKThirtyTwoBytes chain_hash_arg_ref;
42670         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
42671         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
42672         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42673         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
42674         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
42675         LDKPublicKey funding_pubkey_arg_ref;
42676         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
42677         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
42678         LDKPublicKey revocation_basepoint_arg_ref;
42679         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
42680         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
42681         LDKPublicKey payment_point_arg_ref;
42682         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
42683         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
42684         LDKPublicKey delayed_payment_basepoint_arg_ref;
42685         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
42686         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
42687         LDKPublicKey htlc_basepoint_arg_ref;
42688         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
42689         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
42690         LDKPublicKey first_per_commitment_point_arg_ref;
42691         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
42692         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
42693         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42694         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42695         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42696         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42697         LDKChannelTypeFeatures channel_type_arg_conv;
42698         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42699         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42700         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42701         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42702         LDKOpenChannel ret_var = OpenChannel_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
42703         int64_t ret_ref = 0;
42704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42706         return ret_ref;
42707 }
42708
42709 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
42710         LDKOpenChannel ret_var = OpenChannel_clone(arg);
42711         int64_t ret_ref = 0;
42712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42714         return ret_ref;
42715 }
42716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42717         LDKOpenChannel arg_conv;
42718         arg_conv.inner = untag_ptr(arg);
42719         arg_conv.is_owned = ptr_is_owned(arg);
42720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42721         arg_conv.is_owned = false;
42722         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
42723         return ret_conv;
42724 }
42725
42726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42727         LDKOpenChannel orig_conv;
42728         orig_conv.inner = untag_ptr(orig);
42729         orig_conv.is_owned = ptr_is_owned(orig);
42730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42731         orig_conv.is_owned = false;
42732         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
42733         int64_t ret_ref = 0;
42734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42736         return ret_ref;
42737 }
42738
42739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42740         LDKOpenChannel a_conv;
42741         a_conv.inner = untag_ptr(a);
42742         a_conv.is_owned = ptr_is_owned(a);
42743         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42744         a_conv.is_owned = false;
42745         LDKOpenChannel b_conv;
42746         b_conv.inner = untag_ptr(b);
42747         b_conv.is_owned = ptr_is_owned(b);
42748         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42749         b_conv.is_owned = false;
42750         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
42751         return ret_conv;
42752 }
42753
42754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42755         LDKOpenChannelV2 this_obj_conv;
42756         this_obj_conv.inner = untag_ptr(this_obj);
42757         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42759         OpenChannelV2_free(this_obj_conv);
42760 }
42761
42762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
42763         LDKOpenChannelV2 this_ptr_conv;
42764         this_ptr_conv.inner = untag_ptr(this_ptr);
42765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42767         this_ptr_conv.is_owned = false;
42768         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42769         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_chain_hash(&this_ptr_conv));
42770         return ret_arr;
42771 }
42772
42773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42774         LDKOpenChannelV2 this_ptr_conv;
42775         this_ptr_conv.inner = untag_ptr(this_ptr);
42776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42778         this_ptr_conv.is_owned = false;
42779         LDKThirtyTwoBytes val_ref;
42780         CHECK((*env)->GetArrayLength(env, val) == 32);
42781         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42782         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
42783 }
42784
42785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42786         LDKOpenChannelV2 this_ptr_conv;
42787         this_ptr_conv.inner = untag_ptr(this_ptr);
42788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42790         this_ptr_conv.is_owned = false;
42791         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42792         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv));
42793         return ret_arr;
42794 }
42795
42796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42797         LDKOpenChannelV2 this_ptr_conv;
42798         this_ptr_conv.inner = untag_ptr(this_ptr);
42799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42801         this_ptr_conv.is_owned = false;
42802         LDKThirtyTwoBytes val_ref;
42803         CHECK((*env)->GetArrayLength(env, val) == 32);
42804         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42805         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
42806 }
42807
42808 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
42809         LDKOpenChannelV2 this_ptr_conv;
42810         this_ptr_conv.inner = untag_ptr(this_ptr);
42811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42813         this_ptr_conv.is_owned = false;
42814         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
42815         return ret_conv;
42816 }
42817
42818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42819         LDKOpenChannelV2 this_ptr_conv;
42820         this_ptr_conv.inner = untag_ptr(this_ptr);
42821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42823         this_ptr_conv.is_owned = false;
42824         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
42825 }
42826
42827 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
42828         LDKOpenChannelV2 this_ptr_conv;
42829         this_ptr_conv.inner = untag_ptr(this_ptr);
42830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42832         this_ptr_conv.is_owned = false;
42833         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
42834         return ret_conv;
42835 }
42836
42837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42838         LDKOpenChannelV2 this_ptr_conv;
42839         this_ptr_conv.inner = untag_ptr(this_ptr);
42840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42842         this_ptr_conv.is_owned = false;
42843         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
42844 }
42845
42846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42847         LDKOpenChannelV2 this_ptr_conv;
42848         this_ptr_conv.inner = untag_ptr(this_ptr);
42849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42851         this_ptr_conv.is_owned = false;
42852         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
42853         return ret_conv;
42854 }
42855
42856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42857         LDKOpenChannelV2 this_ptr_conv;
42858         this_ptr_conv.inner = untag_ptr(this_ptr);
42859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42861         this_ptr_conv.is_owned = false;
42862         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
42863 }
42864
42865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42866         LDKOpenChannelV2 this_ptr_conv;
42867         this_ptr_conv.inner = untag_ptr(this_ptr);
42868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42870         this_ptr_conv.is_owned = false;
42871         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
42872         return ret_conv;
42873 }
42874
42875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42876         LDKOpenChannelV2 this_ptr_conv;
42877         this_ptr_conv.inner = untag_ptr(this_ptr);
42878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42880         this_ptr_conv.is_owned = false;
42881         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
42882 }
42883
42884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42885         LDKOpenChannelV2 this_ptr_conv;
42886         this_ptr_conv.inner = untag_ptr(this_ptr);
42887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42889         this_ptr_conv.is_owned = false;
42890         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42891         return ret_conv;
42892 }
42893
42894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42895         LDKOpenChannelV2 this_ptr_conv;
42896         this_ptr_conv.inner = untag_ptr(this_ptr);
42897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42899         this_ptr_conv.is_owned = false;
42900         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42901 }
42902
42903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42904         LDKOpenChannelV2 this_ptr_conv;
42905         this_ptr_conv.inner = untag_ptr(this_ptr);
42906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42908         this_ptr_conv.is_owned = false;
42909         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
42910         return ret_conv;
42911 }
42912
42913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42914         LDKOpenChannelV2 this_ptr_conv;
42915         this_ptr_conv.inner = untag_ptr(this_ptr);
42916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42918         this_ptr_conv.is_owned = false;
42919         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
42920 }
42921
42922 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
42923         LDKOpenChannelV2 this_ptr_conv;
42924         this_ptr_conv.inner = untag_ptr(this_ptr);
42925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42927         this_ptr_conv.is_owned = false;
42928         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
42929         return ret_conv;
42930 }
42931
42932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42933         LDKOpenChannelV2 this_ptr_conv;
42934         this_ptr_conv.inner = untag_ptr(this_ptr);
42935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42937         this_ptr_conv.is_owned = false;
42938         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
42939 }
42940
42941 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
42942         LDKOpenChannelV2 this_ptr_conv;
42943         this_ptr_conv.inner = untag_ptr(this_ptr);
42944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42946         this_ptr_conv.is_owned = false;
42947         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
42948         return ret_conv;
42949 }
42950
42951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42952         LDKOpenChannelV2 this_ptr_conv;
42953         this_ptr_conv.inner = untag_ptr(this_ptr);
42954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42956         this_ptr_conv.is_owned = false;
42957         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
42958 }
42959
42960 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
42961         LDKOpenChannelV2 this_ptr_conv;
42962         this_ptr_conv.inner = untag_ptr(this_ptr);
42963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42965         this_ptr_conv.is_owned = false;
42966         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
42967         return ret_conv;
42968 }
42969
42970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42971         LDKOpenChannelV2 this_ptr_conv;
42972         this_ptr_conv.inner = untag_ptr(this_ptr);
42973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42975         this_ptr_conv.is_owned = false;
42976         OpenChannelV2_set_locktime(&this_ptr_conv, val);
42977 }
42978
42979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42980         LDKOpenChannelV2 this_ptr_conv;
42981         this_ptr_conv.inner = untag_ptr(this_ptr);
42982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42984         this_ptr_conv.is_owned = false;
42985         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42986         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
42987         return ret_arr;
42988 }
42989
42990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42991         LDKOpenChannelV2 this_ptr_conv;
42992         this_ptr_conv.inner = untag_ptr(this_ptr);
42993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42995         this_ptr_conv.is_owned = false;
42996         LDKPublicKey val_ref;
42997         CHECK((*env)->GetArrayLength(env, val) == 33);
42998         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42999         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
43000 }
43001
43002 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43003         LDKOpenChannelV2 this_ptr_conv;
43004         this_ptr_conv.inner = untag_ptr(this_ptr);
43005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43007         this_ptr_conv.is_owned = false;
43008         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43009         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43010         return ret_arr;
43011 }
43012
43013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43014         LDKOpenChannelV2 this_ptr_conv;
43015         this_ptr_conv.inner = untag_ptr(this_ptr);
43016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43018         this_ptr_conv.is_owned = false;
43019         LDKPublicKey val_ref;
43020         CHECK((*env)->GetArrayLength(env, val) == 33);
43021         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43022         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
43023 }
43024
43025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43026         LDKOpenChannelV2 this_ptr_conv;
43027         this_ptr_conv.inner = untag_ptr(this_ptr);
43028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43030         this_ptr_conv.is_owned = false;
43031         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43032         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
43033         return ret_arr;
43034 }
43035
43036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43037         LDKOpenChannelV2 this_ptr_conv;
43038         this_ptr_conv.inner = untag_ptr(this_ptr);
43039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43041         this_ptr_conv.is_owned = false;
43042         LDKPublicKey val_ref;
43043         CHECK((*env)->GetArrayLength(env, val) == 33);
43044         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43045         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43046 }
43047
43048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43049         LDKOpenChannelV2 this_ptr_conv;
43050         this_ptr_conv.inner = untag_ptr(this_ptr);
43051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43053         this_ptr_conv.is_owned = false;
43054         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43055         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43056         return ret_arr;
43057 }
43058
43059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43060         LDKOpenChannelV2 this_ptr_conv;
43061         this_ptr_conv.inner = untag_ptr(this_ptr);
43062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43064         this_ptr_conv.is_owned = false;
43065         LDKPublicKey val_ref;
43066         CHECK((*env)->GetArrayLength(env, val) == 33);
43067         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43068         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43069 }
43070
43071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43072         LDKOpenChannelV2 this_ptr_conv;
43073         this_ptr_conv.inner = untag_ptr(this_ptr);
43074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43076         this_ptr_conv.is_owned = false;
43077         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43078         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
43079         return ret_arr;
43080 }
43081
43082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43083         LDKOpenChannelV2 this_ptr_conv;
43084         this_ptr_conv.inner = untag_ptr(this_ptr);
43085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43087         this_ptr_conv.is_owned = false;
43088         LDKPublicKey val_ref;
43089         CHECK((*env)->GetArrayLength(env, val) == 33);
43090         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43091         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
43092 }
43093
43094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43095         LDKOpenChannelV2 this_ptr_conv;
43096         this_ptr_conv.inner = untag_ptr(this_ptr);
43097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43099         this_ptr_conv.is_owned = false;
43100         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43101         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
43102         return ret_arr;
43103 }
43104
43105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43106         LDKOpenChannelV2 this_ptr_conv;
43107         this_ptr_conv.inner = untag_ptr(this_ptr);
43108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43110         this_ptr_conv.is_owned = false;
43111         LDKPublicKey val_ref;
43112         CHECK((*env)->GetArrayLength(env, val) == 33);
43113         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43114         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43115 }
43116
43117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43118         LDKOpenChannelV2 this_ptr_conv;
43119         this_ptr_conv.inner = untag_ptr(this_ptr);
43120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43122         this_ptr_conv.is_owned = false;
43123         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43124         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
43125         return ret_arr;
43126 }
43127
43128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43129         LDKOpenChannelV2 this_ptr_conv;
43130         this_ptr_conv.inner = untag_ptr(this_ptr);
43131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43133         this_ptr_conv.is_owned = false;
43134         LDKPublicKey val_ref;
43135         CHECK((*env)->GetArrayLength(env, val) == 33);
43136         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43137         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
43138 }
43139
43140 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
43141         LDKOpenChannelV2 this_ptr_conv;
43142         this_ptr_conv.inner = untag_ptr(this_ptr);
43143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43145         this_ptr_conv.is_owned = false;
43146         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
43147         return ret_conv;
43148 }
43149
43150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
43151         LDKOpenChannelV2 this_ptr_conv;
43152         this_ptr_conv.inner = untag_ptr(this_ptr);
43153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43155         this_ptr_conv.is_owned = false;
43156         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
43157 }
43158
43159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43160         LDKOpenChannelV2 this_ptr_conv;
43161         this_ptr_conv.inner = untag_ptr(this_ptr);
43162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43164         this_ptr_conv.is_owned = false;
43165         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43166         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
43167         int64_t ret_ref = tag_ptr(ret_copy, true);
43168         return ret_ref;
43169 }
43170
43171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43172         LDKOpenChannelV2 this_ptr_conv;
43173         this_ptr_conv.inner = untag_ptr(this_ptr);
43174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43176         this_ptr_conv.is_owned = false;
43177         void* val_ptr = untag_ptr(val);
43178         CHECK_ACCESS(val_ptr);
43179         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43180         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43181         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43182 }
43183
43184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
43185         LDKOpenChannelV2 this_ptr_conv;
43186         this_ptr_conv.inner = untag_ptr(this_ptr);
43187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43189         this_ptr_conv.is_owned = false;
43190         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
43191         int64_t ret_ref = 0;
43192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43194         return ret_ref;
43195 }
43196
43197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43198         LDKOpenChannelV2 this_ptr_conv;
43199         this_ptr_conv.inner = untag_ptr(this_ptr);
43200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43202         this_ptr_conv.is_owned = false;
43203         LDKChannelTypeFeatures val_conv;
43204         val_conv.inner = untag_ptr(val);
43205         val_conv.is_owned = ptr_is_owned(val);
43206         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43207         val_conv = ChannelTypeFeatures_clone(&val_conv);
43208         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
43209 }
43210
43211 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43212         LDKOpenChannelV2 this_ptr_conv;
43213         this_ptr_conv.inner = untag_ptr(this_ptr);
43214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43216         this_ptr_conv.is_owned = false;
43217         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
43218         return ret_conv;
43219 }
43220
43221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
43222         LDKOpenChannelV2 this_ptr_conv;
43223         this_ptr_conv.inner = untag_ptr(this_ptr);
43224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43226         this_ptr_conv.is_owned = false;
43227         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
43228         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
43229 }
43230
43231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t commitment_feerate_sat_per_1000_weight_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
43232         LDKThirtyTwoBytes chain_hash_arg_ref;
43233         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
43234         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
43235         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43236         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
43237         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
43238         LDKPublicKey funding_pubkey_arg_ref;
43239         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
43240         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
43241         LDKPublicKey revocation_basepoint_arg_ref;
43242         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
43243         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
43244         LDKPublicKey payment_basepoint_arg_ref;
43245         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
43246         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
43247         LDKPublicKey delayed_payment_basepoint_arg_ref;
43248         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
43249         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
43250         LDKPublicKey htlc_basepoint_arg_ref;
43251         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
43252         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
43253         LDKPublicKey first_per_commitment_point_arg_ref;
43254         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
43255         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
43256         LDKPublicKey second_per_commitment_point_arg_ref;
43257         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
43258         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
43259         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43260         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43261         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43262         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43263         LDKChannelTypeFeatures channel_type_arg_conv;
43264         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43265         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43266         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43267         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43268         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
43269         LDKOpenChannelV2 ret_var = OpenChannelV2_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
43270         int64_t ret_ref = 0;
43271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43273         return ret_ref;
43274 }
43275
43276 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
43277         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
43278         int64_t ret_ref = 0;
43279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43281         return ret_ref;
43282 }
43283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43284         LDKOpenChannelV2 arg_conv;
43285         arg_conv.inner = untag_ptr(arg);
43286         arg_conv.is_owned = ptr_is_owned(arg);
43287         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43288         arg_conv.is_owned = false;
43289         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
43290         return ret_conv;
43291 }
43292
43293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43294         LDKOpenChannelV2 orig_conv;
43295         orig_conv.inner = untag_ptr(orig);
43296         orig_conv.is_owned = ptr_is_owned(orig);
43297         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43298         orig_conv.is_owned = false;
43299         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
43300         int64_t ret_ref = 0;
43301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43303         return ret_ref;
43304 }
43305
43306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43307         LDKOpenChannelV2 a_conv;
43308         a_conv.inner = untag_ptr(a);
43309         a_conv.is_owned = ptr_is_owned(a);
43310         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43311         a_conv.is_owned = false;
43312         LDKOpenChannelV2 b_conv;
43313         b_conv.inner = untag_ptr(b);
43314         b_conv.is_owned = ptr_is_owned(b);
43315         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43316         b_conv.is_owned = false;
43317         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
43318         return ret_conv;
43319 }
43320
43321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43322         LDKAcceptChannel this_obj_conv;
43323         this_obj_conv.inner = untag_ptr(this_obj);
43324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43326         AcceptChannel_free(this_obj_conv);
43327 }
43328
43329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43330         LDKAcceptChannel this_ptr_conv;
43331         this_ptr_conv.inner = untag_ptr(this_ptr);
43332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43334         this_ptr_conv.is_owned = false;
43335         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43336         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
43337         return ret_arr;
43338 }
43339
43340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43341         LDKAcceptChannel this_ptr_conv;
43342         this_ptr_conv.inner = untag_ptr(this_ptr);
43343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43345         this_ptr_conv.is_owned = false;
43346         LDKThirtyTwoBytes val_ref;
43347         CHECK((*env)->GetArrayLength(env, val) == 32);
43348         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43349         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
43350 }
43351
43352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43353         LDKAcceptChannel this_ptr_conv;
43354         this_ptr_conv.inner = untag_ptr(this_ptr);
43355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43357         this_ptr_conv.is_owned = false;
43358         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
43359         return ret_conv;
43360 }
43361
43362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43363         LDKAcceptChannel this_ptr_conv;
43364         this_ptr_conv.inner = untag_ptr(this_ptr);
43365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43367         this_ptr_conv.is_owned = false;
43368         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
43369 }
43370
43371 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) {
43372         LDKAcceptChannel this_ptr_conv;
43373         this_ptr_conv.inner = untag_ptr(this_ptr);
43374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43376         this_ptr_conv.is_owned = false;
43377         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
43378         return ret_conv;
43379 }
43380
43381 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) {
43382         LDKAcceptChannel this_ptr_conv;
43383         this_ptr_conv.inner = untag_ptr(this_ptr);
43384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43386         this_ptr_conv.is_owned = false;
43387         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
43388 }
43389
43390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43391         LDKAcceptChannel this_ptr_conv;
43392         this_ptr_conv.inner = untag_ptr(this_ptr);
43393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43395         this_ptr_conv.is_owned = false;
43396         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
43397         return ret_conv;
43398 }
43399
43400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43401         LDKAcceptChannel this_ptr_conv;
43402         this_ptr_conv.inner = untag_ptr(this_ptr);
43403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43405         this_ptr_conv.is_owned = false;
43406         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
43407 }
43408
43409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43410         LDKAcceptChannel this_ptr_conv;
43411         this_ptr_conv.inner = untag_ptr(this_ptr);
43412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43414         this_ptr_conv.is_owned = false;
43415         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
43416         return ret_conv;
43417 }
43418
43419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43420         LDKAcceptChannel this_ptr_conv;
43421         this_ptr_conv.inner = untag_ptr(this_ptr);
43422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43424         this_ptr_conv.is_owned = false;
43425         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
43426 }
43427
43428 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
43429         LDKAcceptChannel this_ptr_conv;
43430         this_ptr_conv.inner = untag_ptr(this_ptr);
43431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43433         this_ptr_conv.is_owned = false;
43434         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
43435         return ret_conv;
43436 }
43437
43438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43439         LDKAcceptChannel this_ptr_conv;
43440         this_ptr_conv.inner = untag_ptr(this_ptr);
43441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43443         this_ptr_conv.is_owned = false;
43444         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
43445 }
43446
43447 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43448         LDKAcceptChannel this_ptr_conv;
43449         this_ptr_conv.inner = untag_ptr(this_ptr);
43450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43452         this_ptr_conv.is_owned = false;
43453         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
43454         return ret_conv;
43455 }
43456
43457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43458         LDKAcceptChannel this_ptr_conv;
43459         this_ptr_conv.inner = untag_ptr(this_ptr);
43460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43462         this_ptr_conv.is_owned = false;
43463         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
43464 }
43465
43466 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43467         LDKAcceptChannel this_ptr_conv;
43468         this_ptr_conv.inner = untag_ptr(this_ptr);
43469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43471         this_ptr_conv.is_owned = false;
43472         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
43473         return ret_conv;
43474 }
43475
43476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43477         LDKAcceptChannel this_ptr_conv;
43478         this_ptr_conv.inner = untag_ptr(this_ptr);
43479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43481         this_ptr_conv.is_owned = false;
43482         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
43483 }
43484
43485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43486         LDKAcceptChannel this_ptr_conv;
43487         this_ptr_conv.inner = untag_ptr(this_ptr);
43488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43490         this_ptr_conv.is_owned = false;
43491         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43492         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
43493         return ret_arr;
43494 }
43495
43496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43497         LDKAcceptChannel this_ptr_conv;
43498         this_ptr_conv.inner = untag_ptr(this_ptr);
43499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43501         this_ptr_conv.is_owned = false;
43502         LDKPublicKey val_ref;
43503         CHECK((*env)->GetArrayLength(env, val) == 33);
43504         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43505         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
43506 }
43507
43508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43509         LDKAcceptChannel this_ptr_conv;
43510         this_ptr_conv.inner = untag_ptr(this_ptr);
43511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43513         this_ptr_conv.is_owned = false;
43514         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43515         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43516         return ret_arr;
43517 }
43518
43519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43520         LDKAcceptChannel this_ptr_conv;
43521         this_ptr_conv.inner = untag_ptr(this_ptr);
43522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43524         this_ptr_conv.is_owned = false;
43525         LDKPublicKey val_ref;
43526         CHECK((*env)->GetArrayLength(env, val) == 33);
43527         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43528         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
43529 }
43530
43531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43532         LDKAcceptChannel this_ptr_conv;
43533         this_ptr_conv.inner = untag_ptr(this_ptr);
43534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43536         this_ptr_conv.is_owned = false;
43537         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43538         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
43539         return ret_arr;
43540 }
43541
43542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43543         LDKAcceptChannel this_ptr_conv;
43544         this_ptr_conv.inner = untag_ptr(this_ptr);
43545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43547         this_ptr_conv.is_owned = false;
43548         LDKPublicKey val_ref;
43549         CHECK((*env)->GetArrayLength(env, val) == 33);
43550         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43551         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
43552 }
43553
43554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43555         LDKAcceptChannel this_ptr_conv;
43556         this_ptr_conv.inner = untag_ptr(this_ptr);
43557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43559         this_ptr_conv.is_owned = false;
43560         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43561         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43562         return ret_arr;
43563 }
43564
43565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43566         LDKAcceptChannel this_ptr_conv;
43567         this_ptr_conv.inner = untag_ptr(this_ptr);
43568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43570         this_ptr_conv.is_owned = false;
43571         LDKPublicKey val_ref;
43572         CHECK((*env)->GetArrayLength(env, val) == 33);
43573         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43574         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43575 }
43576
43577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43578         LDKAcceptChannel this_ptr_conv;
43579         this_ptr_conv.inner = untag_ptr(this_ptr);
43580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43582         this_ptr_conv.is_owned = false;
43583         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43584         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
43585         return ret_arr;
43586 }
43587
43588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43589         LDKAcceptChannel this_ptr_conv;
43590         this_ptr_conv.inner = untag_ptr(this_ptr);
43591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43593         this_ptr_conv.is_owned = false;
43594         LDKPublicKey val_ref;
43595         CHECK((*env)->GetArrayLength(env, val) == 33);
43596         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43597         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
43598 }
43599
43600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43601         LDKAcceptChannel this_ptr_conv;
43602         this_ptr_conv.inner = untag_ptr(this_ptr);
43603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43605         this_ptr_conv.is_owned = false;
43606         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43607         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
43608         return ret_arr;
43609 }
43610
43611 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) {
43612         LDKAcceptChannel this_ptr_conv;
43613         this_ptr_conv.inner = untag_ptr(this_ptr);
43614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43616         this_ptr_conv.is_owned = false;
43617         LDKPublicKey val_ref;
43618         CHECK((*env)->GetArrayLength(env, val) == 33);
43619         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43620         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43621 }
43622
43623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43624         LDKAcceptChannel this_ptr_conv;
43625         this_ptr_conv.inner = untag_ptr(this_ptr);
43626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43628         this_ptr_conv.is_owned = false;
43629         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43630         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
43631         int64_t ret_ref = tag_ptr(ret_copy, true);
43632         return ret_ref;
43633 }
43634
43635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43636         LDKAcceptChannel this_ptr_conv;
43637         this_ptr_conv.inner = untag_ptr(this_ptr);
43638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43640         this_ptr_conv.is_owned = false;
43641         void* val_ptr = untag_ptr(val);
43642         CHECK_ACCESS(val_ptr);
43643         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43644         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43645         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43646 }
43647
43648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
43649         LDKAcceptChannel this_ptr_conv;
43650         this_ptr_conv.inner = untag_ptr(this_ptr);
43651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43653         this_ptr_conv.is_owned = false;
43654         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
43655         int64_t ret_ref = 0;
43656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43658         return ret_ref;
43659 }
43660
43661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43662         LDKAcceptChannel this_ptr_conv;
43663         this_ptr_conv.inner = untag_ptr(this_ptr);
43664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43666         this_ptr_conv.is_owned = false;
43667         LDKChannelTypeFeatures val_conv;
43668         val_conv.inner = untag_ptr(val);
43669         val_conv.is_owned = ptr_is_owned(val);
43670         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43671         val_conv = ChannelTypeFeatures_clone(&val_conv);
43672         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
43673 }
43674
43675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, 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, int8_tArray first_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
43676         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43677         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
43678         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
43679         LDKPublicKey funding_pubkey_arg_ref;
43680         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
43681         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
43682         LDKPublicKey revocation_basepoint_arg_ref;
43683         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
43684         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
43685         LDKPublicKey payment_point_arg_ref;
43686         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
43687         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
43688         LDKPublicKey delayed_payment_basepoint_arg_ref;
43689         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
43690         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
43691         LDKPublicKey htlc_basepoint_arg_ref;
43692         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
43693         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
43694         LDKPublicKey first_per_commitment_point_arg_ref;
43695         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
43696         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
43697         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43698         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43699         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43700         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43701         LDKChannelTypeFeatures channel_type_arg_conv;
43702         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43703         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43704         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43705         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43706         LDKAcceptChannel ret_var = AcceptChannel_new(temporary_channel_id_arg_ref, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
43707         int64_t ret_ref = 0;
43708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43710         return ret_ref;
43711 }
43712
43713 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
43714         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
43715         int64_t ret_ref = 0;
43716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43718         return ret_ref;
43719 }
43720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43721         LDKAcceptChannel arg_conv;
43722         arg_conv.inner = untag_ptr(arg);
43723         arg_conv.is_owned = ptr_is_owned(arg);
43724         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43725         arg_conv.is_owned = false;
43726         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
43727         return ret_conv;
43728 }
43729
43730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43731         LDKAcceptChannel orig_conv;
43732         orig_conv.inner = untag_ptr(orig);
43733         orig_conv.is_owned = ptr_is_owned(orig);
43734         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43735         orig_conv.is_owned = false;
43736         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
43737         int64_t ret_ref = 0;
43738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43740         return ret_ref;
43741 }
43742
43743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43744         LDKAcceptChannel a_conv;
43745         a_conv.inner = untag_ptr(a);
43746         a_conv.is_owned = ptr_is_owned(a);
43747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43748         a_conv.is_owned = false;
43749         LDKAcceptChannel b_conv;
43750         b_conv.inner = untag_ptr(b);
43751         b_conv.is_owned = ptr_is_owned(b);
43752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43753         b_conv.is_owned = false;
43754         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
43755         return ret_conv;
43756 }
43757
43758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43759         LDKAcceptChannelV2 this_obj_conv;
43760         this_obj_conv.inner = untag_ptr(this_obj);
43761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43763         AcceptChannelV2_free(this_obj_conv);
43764 }
43765
43766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43767         LDKAcceptChannelV2 this_ptr_conv;
43768         this_ptr_conv.inner = untag_ptr(this_ptr);
43769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43771         this_ptr_conv.is_owned = false;
43772         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43773         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv));
43774         return ret_arr;
43775 }
43776
43777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43778         LDKAcceptChannelV2 this_ptr_conv;
43779         this_ptr_conv.inner = untag_ptr(this_ptr);
43780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43782         this_ptr_conv.is_owned = false;
43783         LDKThirtyTwoBytes val_ref;
43784         CHECK((*env)->GetArrayLength(env, val) == 32);
43785         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43786         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
43787 }
43788
43789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43790         LDKAcceptChannelV2 this_ptr_conv;
43791         this_ptr_conv.inner = untag_ptr(this_ptr);
43792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43794         this_ptr_conv.is_owned = false;
43795         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
43796         return ret_conv;
43797 }
43798
43799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43800         LDKAcceptChannelV2 this_ptr_conv;
43801         this_ptr_conv.inner = untag_ptr(this_ptr);
43802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43804         this_ptr_conv.is_owned = false;
43805         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
43806 }
43807
43808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43809         LDKAcceptChannelV2 this_ptr_conv;
43810         this_ptr_conv.inner = untag_ptr(this_ptr);
43811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43813         this_ptr_conv.is_owned = false;
43814         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
43815         return ret_conv;
43816 }
43817
43818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43819         LDKAcceptChannelV2 this_ptr_conv;
43820         this_ptr_conv.inner = untag_ptr(this_ptr);
43821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43823         this_ptr_conv.is_owned = false;
43824         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
43825 }
43826
43827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43828         LDKAcceptChannelV2 this_ptr_conv;
43829         this_ptr_conv.inner = untag_ptr(this_ptr);
43830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43832         this_ptr_conv.is_owned = false;
43833         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
43834         return ret_conv;
43835 }
43836
43837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43838         LDKAcceptChannelV2 this_ptr_conv;
43839         this_ptr_conv.inner = untag_ptr(this_ptr);
43840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43842         this_ptr_conv.is_owned = false;
43843         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
43844 }
43845
43846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43847         LDKAcceptChannelV2 this_ptr_conv;
43848         this_ptr_conv.inner = untag_ptr(this_ptr);
43849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43851         this_ptr_conv.is_owned = false;
43852         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
43853         return ret_conv;
43854 }
43855
43856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43857         LDKAcceptChannelV2 this_ptr_conv;
43858         this_ptr_conv.inner = untag_ptr(this_ptr);
43859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43861         this_ptr_conv.is_owned = false;
43862         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
43863 }
43864
43865 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
43866         LDKAcceptChannelV2 this_ptr_conv;
43867         this_ptr_conv.inner = untag_ptr(this_ptr);
43868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43870         this_ptr_conv.is_owned = false;
43871         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
43872         return ret_conv;
43873 }
43874
43875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43876         LDKAcceptChannelV2 this_ptr_conv;
43877         this_ptr_conv.inner = untag_ptr(this_ptr);
43878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43880         this_ptr_conv.is_owned = false;
43881         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
43882 }
43883
43884 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43885         LDKAcceptChannelV2 this_ptr_conv;
43886         this_ptr_conv.inner = untag_ptr(this_ptr);
43887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43889         this_ptr_conv.is_owned = false;
43890         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
43891         return ret_conv;
43892 }
43893
43894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43895         LDKAcceptChannelV2 this_ptr_conv;
43896         this_ptr_conv.inner = untag_ptr(this_ptr);
43897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43899         this_ptr_conv.is_owned = false;
43900         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
43901 }
43902
43903 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43904         LDKAcceptChannelV2 this_ptr_conv;
43905         this_ptr_conv.inner = untag_ptr(this_ptr);
43906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43908         this_ptr_conv.is_owned = false;
43909         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
43910         return ret_conv;
43911 }
43912
43913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43914         LDKAcceptChannelV2 this_ptr_conv;
43915         this_ptr_conv.inner = untag_ptr(this_ptr);
43916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43918         this_ptr_conv.is_owned = false;
43919         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
43920 }
43921
43922 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43923         LDKAcceptChannelV2 this_ptr_conv;
43924         this_ptr_conv.inner = untag_ptr(this_ptr);
43925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43927         this_ptr_conv.is_owned = false;
43928         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43929         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
43930         return ret_arr;
43931 }
43932
43933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43934         LDKAcceptChannelV2 this_ptr_conv;
43935         this_ptr_conv.inner = untag_ptr(this_ptr);
43936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43938         this_ptr_conv.is_owned = false;
43939         LDKPublicKey val_ref;
43940         CHECK((*env)->GetArrayLength(env, val) == 33);
43941         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43942         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
43943 }
43944
43945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43946         LDKAcceptChannelV2 this_ptr_conv;
43947         this_ptr_conv.inner = untag_ptr(this_ptr);
43948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43950         this_ptr_conv.is_owned = false;
43951         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43952         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43953         return ret_arr;
43954 }
43955
43956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43957         LDKAcceptChannelV2 this_ptr_conv;
43958         this_ptr_conv.inner = untag_ptr(this_ptr);
43959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43961         this_ptr_conv.is_owned = false;
43962         LDKPublicKey val_ref;
43963         CHECK((*env)->GetArrayLength(env, val) == 33);
43964         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43965         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
43966 }
43967
43968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43969         LDKAcceptChannelV2 this_ptr_conv;
43970         this_ptr_conv.inner = untag_ptr(this_ptr);
43971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43973         this_ptr_conv.is_owned = false;
43974         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43975         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
43976         return ret_arr;
43977 }
43978
43979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43980         LDKAcceptChannelV2 this_ptr_conv;
43981         this_ptr_conv.inner = untag_ptr(this_ptr);
43982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43984         this_ptr_conv.is_owned = false;
43985         LDKPublicKey val_ref;
43986         CHECK((*env)->GetArrayLength(env, val) == 33);
43987         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43988         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43989 }
43990
43991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43992         LDKAcceptChannelV2 this_ptr_conv;
43993         this_ptr_conv.inner = untag_ptr(this_ptr);
43994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43996         this_ptr_conv.is_owned = false;
43997         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43998         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43999         return ret_arr;
44000 }
44001
44002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44003         LDKAcceptChannelV2 this_ptr_conv;
44004         this_ptr_conv.inner = untag_ptr(this_ptr);
44005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44007         this_ptr_conv.is_owned = false;
44008         LDKPublicKey val_ref;
44009         CHECK((*env)->GetArrayLength(env, val) == 33);
44010         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44011         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
44012 }
44013
44014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44015         LDKAcceptChannelV2 this_ptr_conv;
44016         this_ptr_conv.inner = untag_ptr(this_ptr);
44017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44019         this_ptr_conv.is_owned = false;
44020         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44021         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
44022         return ret_arr;
44023 }
44024
44025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44026         LDKAcceptChannelV2 this_ptr_conv;
44027         this_ptr_conv.inner = untag_ptr(this_ptr);
44028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44030         this_ptr_conv.is_owned = false;
44031         LDKPublicKey val_ref;
44032         CHECK((*env)->GetArrayLength(env, val) == 33);
44033         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44034         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
44035 }
44036
44037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44038         LDKAcceptChannelV2 this_ptr_conv;
44039         this_ptr_conv.inner = untag_ptr(this_ptr);
44040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44042         this_ptr_conv.is_owned = false;
44043         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44044         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
44045         return ret_arr;
44046 }
44047
44048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44049         LDKAcceptChannelV2 this_ptr_conv;
44050         this_ptr_conv.inner = untag_ptr(this_ptr);
44051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44053         this_ptr_conv.is_owned = false;
44054         LDKPublicKey val_ref;
44055         CHECK((*env)->GetArrayLength(env, val) == 33);
44056         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44057         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
44058 }
44059
44060 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44061         LDKAcceptChannelV2 this_ptr_conv;
44062         this_ptr_conv.inner = untag_ptr(this_ptr);
44063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44065         this_ptr_conv.is_owned = false;
44066         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44067         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
44068         return ret_arr;
44069 }
44070
44071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44072         LDKAcceptChannelV2 this_ptr_conv;
44073         this_ptr_conv.inner = untag_ptr(this_ptr);
44074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44076         this_ptr_conv.is_owned = false;
44077         LDKPublicKey val_ref;
44078         CHECK((*env)->GetArrayLength(env, val) == 33);
44079         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44080         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
44081 }
44082
44083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44084         LDKAcceptChannelV2 this_ptr_conv;
44085         this_ptr_conv.inner = untag_ptr(this_ptr);
44086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44088         this_ptr_conv.is_owned = false;
44089         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
44090         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
44091         int64_t ret_ref = tag_ptr(ret_copy, true);
44092         return ret_ref;
44093 }
44094
44095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44096         LDKAcceptChannelV2 this_ptr_conv;
44097         this_ptr_conv.inner = untag_ptr(this_ptr);
44098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44100         this_ptr_conv.is_owned = false;
44101         void* val_ptr = untag_ptr(val);
44102         CHECK_ACCESS(val_ptr);
44103         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
44104         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
44105         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
44106 }
44107
44108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
44109         LDKAcceptChannelV2 this_ptr_conv;
44110         this_ptr_conv.inner = untag_ptr(this_ptr);
44111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44113         this_ptr_conv.is_owned = false;
44114         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
44115         int64_t ret_ref = 0;
44116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44118         return ret_ref;
44119 }
44120
44121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44122         LDKAcceptChannelV2 this_ptr_conv;
44123         this_ptr_conv.inner = untag_ptr(this_ptr);
44124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44126         this_ptr_conv.is_owned = false;
44127         LDKChannelTypeFeatures val_conv;
44128         val_conv.inner = untag_ptr(val);
44129         val_conv.is_owned = ptr_is_owned(val);
44130         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44131         val_conv = ChannelTypeFeatures_clone(&val_conv);
44132         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
44133 }
44134
44135 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
44136         LDKAcceptChannelV2 this_ptr_conv;
44137         this_ptr_conv.inner = untag_ptr(this_ptr);
44138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44140         this_ptr_conv.is_owned = false;
44141         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
44142         return ret_conv;
44143 }
44144
44145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
44146         LDKAcceptChannelV2 this_ptr_conv;
44147         this_ptr_conv.inner = untag_ptr(this_ptr);
44148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44150         this_ptr_conv.is_owned = false;
44151         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
44152         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
44153 }
44154
44155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
44156         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44157         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44158         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44159         LDKPublicKey funding_pubkey_arg_ref;
44160         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
44161         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
44162         LDKPublicKey revocation_basepoint_arg_ref;
44163         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
44164         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
44165         LDKPublicKey payment_basepoint_arg_ref;
44166         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
44167         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
44168         LDKPublicKey delayed_payment_basepoint_arg_ref;
44169         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
44170         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
44171         LDKPublicKey htlc_basepoint_arg_ref;
44172         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
44173         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
44174         LDKPublicKey first_per_commitment_point_arg_ref;
44175         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
44176         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
44177         LDKPublicKey second_per_commitment_point_arg_ref;
44178         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
44179         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
44180         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
44181         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
44182         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
44183         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
44184         LDKChannelTypeFeatures channel_type_arg_conv;
44185         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
44186         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
44187         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
44188         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
44189         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
44190         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(temporary_channel_id_arg_ref, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
44191         int64_t ret_ref = 0;
44192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44194         return ret_ref;
44195 }
44196
44197 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
44198         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
44199         int64_t ret_ref = 0;
44200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44202         return ret_ref;
44203 }
44204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44205         LDKAcceptChannelV2 arg_conv;
44206         arg_conv.inner = untag_ptr(arg);
44207         arg_conv.is_owned = ptr_is_owned(arg);
44208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44209         arg_conv.is_owned = false;
44210         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
44211         return ret_conv;
44212 }
44213
44214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44215         LDKAcceptChannelV2 orig_conv;
44216         orig_conv.inner = untag_ptr(orig);
44217         orig_conv.is_owned = ptr_is_owned(orig);
44218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44219         orig_conv.is_owned = false;
44220         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
44221         int64_t ret_ref = 0;
44222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44224         return ret_ref;
44225 }
44226
44227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44228         LDKAcceptChannelV2 a_conv;
44229         a_conv.inner = untag_ptr(a);
44230         a_conv.is_owned = ptr_is_owned(a);
44231         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44232         a_conv.is_owned = false;
44233         LDKAcceptChannelV2 b_conv;
44234         b_conv.inner = untag_ptr(b);
44235         b_conv.is_owned = ptr_is_owned(b);
44236         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44237         b_conv.is_owned = false;
44238         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
44239         return ret_conv;
44240 }
44241
44242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44243         LDKFundingCreated this_obj_conv;
44244         this_obj_conv.inner = untag_ptr(this_obj);
44245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44247         FundingCreated_free(this_obj_conv);
44248 }
44249
44250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44251         LDKFundingCreated this_ptr_conv;
44252         this_ptr_conv.inner = untag_ptr(this_ptr);
44253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44255         this_ptr_conv.is_owned = false;
44256         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44257         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
44258         return ret_arr;
44259 }
44260
44261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44262         LDKFundingCreated this_ptr_conv;
44263         this_ptr_conv.inner = untag_ptr(this_ptr);
44264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44266         this_ptr_conv.is_owned = false;
44267         LDKThirtyTwoBytes val_ref;
44268         CHECK((*env)->GetArrayLength(env, val) == 32);
44269         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44270         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
44271 }
44272
44273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
44274         LDKFundingCreated this_ptr_conv;
44275         this_ptr_conv.inner = untag_ptr(this_ptr);
44276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44278         this_ptr_conv.is_owned = false;
44279         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44280         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
44281         return ret_arr;
44282 }
44283
44284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44285         LDKFundingCreated this_ptr_conv;
44286         this_ptr_conv.inner = untag_ptr(this_ptr);
44287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44289         this_ptr_conv.is_owned = false;
44290         LDKThirtyTwoBytes val_ref;
44291         CHECK((*env)->GetArrayLength(env, val) == 32);
44292         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44293         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
44294 }
44295
44296 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
44297         LDKFundingCreated this_ptr_conv;
44298         this_ptr_conv.inner = untag_ptr(this_ptr);
44299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44301         this_ptr_conv.is_owned = false;
44302         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
44303         return ret_conv;
44304 }
44305
44306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44307         LDKFundingCreated this_ptr_conv;
44308         this_ptr_conv.inner = untag_ptr(this_ptr);
44309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44311         this_ptr_conv.is_owned = false;
44312         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
44313 }
44314
44315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
44316         LDKFundingCreated this_ptr_conv;
44317         this_ptr_conv.inner = untag_ptr(this_ptr);
44318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44320         this_ptr_conv.is_owned = false;
44321         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
44322         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
44323         return ret_arr;
44324 }
44325
44326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44327         LDKFundingCreated this_ptr_conv;
44328         this_ptr_conv.inner = untag_ptr(this_ptr);
44329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44331         this_ptr_conv.is_owned = false;
44332         LDKECDSASignature val_ref;
44333         CHECK((*env)->GetArrayLength(env, val) == 64);
44334         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
44335         FundingCreated_set_signature(&this_ptr_conv, val_ref);
44336 }
44337
44338 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) {
44339         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44340         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44341         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44342         LDKThirtyTwoBytes funding_txid_arg_ref;
44343         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
44344         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
44345         LDKECDSASignature signature_arg_ref;
44346         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
44347         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
44348         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
44349         int64_t ret_ref = 0;
44350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44352         return ret_ref;
44353 }
44354
44355 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
44356         LDKFundingCreated ret_var = FundingCreated_clone(arg);
44357         int64_t ret_ref = 0;
44358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44360         return ret_ref;
44361 }
44362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44363         LDKFundingCreated arg_conv;
44364         arg_conv.inner = untag_ptr(arg);
44365         arg_conv.is_owned = ptr_is_owned(arg);
44366         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44367         arg_conv.is_owned = false;
44368         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
44369         return ret_conv;
44370 }
44371
44372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44373         LDKFundingCreated orig_conv;
44374         orig_conv.inner = untag_ptr(orig);
44375         orig_conv.is_owned = ptr_is_owned(orig);
44376         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44377         orig_conv.is_owned = false;
44378         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
44379         int64_t ret_ref = 0;
44380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44382         return ret_ref;
44383 }
44384
44385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44386         LDKFundingCreated a_conv;
44387         a_conv.inner = untag_ptr(a);
44388         a_conv.is_owned = ptr_is_owned(a);
44389         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44390         a_conv.is_owned = false;
44391         LDKFundingCreated b_conv;
44392         b_conv.inner = untag_ptr(b);
44393         b_conv.is_owned = ptr_is_owned(b);
44394         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44395         b_conv.is_owned = false;
44396         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
44397         return ret_conv;
44398 }
44399
44400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44401         LDKFundingSigned this_obj_conv;
44402         this_obj_conv.inner = untag_ptr(this_obj);
44403         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44405         FundingSigned_free(this_obj_conv);
44406 }
44407
44408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44409         LDKFundingSigned this_ptr_conv;
44410         this_ptr_conv.inner = untag_ptr(this_ptr);
44411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44413         this_ptr_conv.is_owned = false;
44414         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44415         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
44416         return ret_arr;
44417 }
44418
44419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44420         LDKFundingSigned this_ptr_conv;
44421         this_ptr_conv.inner = untag_ptr(this_ptr);
44422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44424         this_ptr_conv.is_owned = false;
44425         LDKThirtyTwoBytes val_ref;
44426         CHECK((*env)->GetArrayLength(env, val) == 32);
44427         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44428         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
44429 }
44430
44431 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
44432         LDKFundingSigned this_ptr_conv;
44433         this_ptr_conv.inner = untag_ptr(this_ptr);
44434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44436         this_ptr_conv.is_owned = false;
44437         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
44438         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
44439         return ret_arr;
44440 }
44441
44442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44443         LDKFundingSigned this_ptr_conv;
44444         this_ptr_conv.inner = untag_ptr(this_ptr);
44445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44447         this_ptr_conv.is_owned = false;
44448         LDKECDSASignature val_ref;
44449         CHECK((*env)->GetArrayLength(env, val) == 64);
44450         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
44451         FundingSigned_set_signature(&this_ptr_conv, val_ref);
44452 }
44453
44454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
44455         LDKThirtyTwoBytes channel_id_arg_ref;
44456         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44457         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44458         LDKECDSASignature signature_arg_ref;
44459         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
44460         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
44461         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
44462         int64_t ret_ref = 0;
44463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44465         return ret_ref;
44466 }
44467
44468 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
44469         LDKFundingSigned ret_var = FundingSigned_clone(arg);
44470         int64_t ret_ref = 0;
44471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44473         return ret_ref;
44474 }
44475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44476         LDKFundingSigned arg_conv;
44477         arg_conv.inner = untag_ptr(arg);
44478         arg_conv.is_owned = ptr_is_owned(arg);
44479         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44480         arg_conv.is_owned = false;
44481         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
44482         return ret_conv;
44483 }
44484
44485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44486         LDKFundingSigned orig_conv;
44487         orig_conv.inner = untag_ptr(orig);
44488         orig_conv.is_owned = ptr_is_owned(orig);
44489         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44490         orig_conv.is_owned = false;
44491         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
44492         int64_t ret_ref = 0;
44493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44495         return ret_ref;
44496 }
44497
44498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44499         LDKFundingSigned a_conv;
44500         a_conv.inner = untag_ptr(a);
44501         a_conv.is_owned = ptr_is_owned(a);
44502         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44503         a_conv.is_owned = false;
44504         LDKFundingSigned b_conv;
44505         b_conv.inner = untag_ptr(b);
44506         b_conv.is_owned = ptr_is_owned(b);
44507         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44508         b_conv.is_owned = false;
44509         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
44510         return ret_conv;
44511 }
44512
44513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44514         LDKChannelReady this_obj_conv;
44515         this_obj_conv.inner = untag_ptr(this_obj);
44516         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44518         ChannelReady_free(this_obj_conv);
44519 }
44520
44521 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44522         LDKChannelReady this_ptr_conv;
44523         this_ptr_conv.inner = untag_ptr(this_ptr);
44524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44526         this_ptr_conv.is_owned = false;
44527         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44528         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
44529         return ret_arr;
44530 }
44531
44532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44533         LDKChannelReady this_ptr_conv;
44534         this_ptr_conv.inner = untag_ptr(this_ptr);
44535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44537         this_ptr_conv.is_owned = false;
44538         LDKThirtyTwoBytes val_ref;
44539         CHECK((*env)->GetArrayLength(env, val) == 32);
44540         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44541         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
44542 }
44543
44544 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44545         LDKChannelReady this_ptr_conv;
44546         this_ptr_conv.inner = untag_ptr(this_ptr);
44547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44549         this_ptr_conv.is_owned = false;
44550         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44551         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
44552         return ret_arr;
44553 }
44554
44555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44556         LDKChannelReady this_ptr_conv;
44557         this_ptr_conv.inner = untag_ptr(this_ptr);
44558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44560         this_ptr_conv.is_owned = false;
44561         LDKPublicKey val_ref;
44562         CHECK((*env)->GetArrayLength(env, val) == 33);
44563         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44564         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
44565 }
44566
44567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
44568         LDKChannelReady this_ptr_conv;
44569         this_ptr_conv.inner = untag_ptr(this_ptr);
44570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44572         this_ptr_conv.is_owned = false;
44573         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44574         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
44575         int64_t ret_ref = tag_ptr(ret_copy, true);
44576         return ret_ref;
44577 }
44578
44579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44580         LDKChannelReady this_ptr_conv;
44581         this_ptr_conv.inner = untag_ptr(this_ptr);
44582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44584         this_ptr_conv.is_owned = false;
44585         void* val_ptr = untag_ptr(val);
44586         CHECK_ACCESS(val_ptr);
44587         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44588         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44589         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
44590 }
44591
44592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
44593         LDKThirtyTwoBytes channel_id_arg_ref;
44594         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44595         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44596         LDKPublicKey next_per_commitment_point_arg_ref;
44597         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
44598         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
44599         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
44600         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
44601         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
44602         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
44603         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
44604         int64_t ret_ref = 0;
44605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44607         return ret_ref;
44608 }
44609
44610 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
44611         LDKChannelReady ret_var = ChannelReady_clone(arg);
44612         int64_t ret_ref = 0;
44613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44615         return ret_ref;
44616 }
44617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44618         LDKChannelReady arg_conv;
44619         arg_conv.inner = untag_ptr(arg);
44620         arg_conv.is_owned = ptr_is_owned(arg);
44621         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44622         arg_conv.is_owned = false;
44623         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
44624         return ret_conv;
44625 }
44626
44627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44628         LDKChannelReady orig_conv;
44629         orig_conv.inner = untag_ptr(orig);
44630         orig_conv.is_owned = ptr_is_owned(orig);
44631         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44632         orig_conv.is_owned = false;
44633         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
44634         int64_t ret_ref = 0;
44635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44637         return ret_ref;
44638 }
44639
44640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44641         LDKChannelReady a_conv;
44642         a_conv.inner = untag_ptr(a);
44643         a_conv.is_owned = ptr_is_owned(a);
44644         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44645         a_conv.is_owned = false;
44646         LDKChannelReady b_conv;
44647         b_conv.inner = untag_ptr(b);
44648         b_conv.is_owned = ptr_is_owned(b);
44649         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44650         b_conv.is_owned = false;
44651         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
44652         return ret_conv;
44653 }
44654
44655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44656         LDKTxAddInput this_obj_conv;
44657         this_obj_conv.inner = untag_ptr(this_obj);
44658         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44660         TxAddInput_free(this_obj_conv);
44661 }
44662
44663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44664         LDKTxAddInput this_ptr_conv;
44665         this_ptr_conv.inner = untag_ptr(this_ptr);
44666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44668         this_ptr_conv.is_owned = false;
44669         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44670         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddInput_get_channel_id(&this_ptr_conv));
44671         return ret_arr;
44672 }
44673
44674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44675         LDKTxAddInput this_ptr_conv;
44676         this_ptr_conv.inner = untag_ptr(this_ptr);
44677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44679         this_ptr_conv.is_owned = false;
44680         LDKThirtyTwoBytes val_ref;
44681         CHECK((*env)->GetArrayLength(env, val) == 32);
44682         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44683         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
44684 }
44685
44686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44687         LDKTxAddInput this_ptr_conv;
44688         this_ptr_conv.inner = untag_ptr(this_ptr);
44689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44691         this_ptr_conv.is_owned = false;
44692         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
44693         return ret_conv;
44694 }
44695
44696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44697         LDKTxAddInput this_ptr_conv;
44698         this_ptr_conv.inner = untag_ptr(this_ptr);
44699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44701         this_ptr_conv.is_owned = false;
44702         TxAddInput_set_serial_id(&this_ptr_conv, val);
44703 }
44704
44705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
44706         LDKTxAddInput this_ptr_conv;
44707         this_ptr_conv.inner = untag_ptr(this_ptr);
44708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44710         this_ptr_conv.is_owned = false;
44711         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
44712         int64_t ret_ref = 0;
44713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44715         return ret_ref;
44716 }
44717
44718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44719         LDKTxAddInput this_ptr_conv;
44720         this_ptr_conv.inner = untag_ptr(this_ptr);
44721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44723         this_ptr_conv.is_owned = false;
44724         LDKTransactionU16LenLimited val_conv;
44725         val_conv.inner = untag_ptr(val);
44726         val_conv.is_owned = ptr_is_owned(val);
44727         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44728         val_conv = TransactionU16LenLimited_clone(&val_conv);
44729         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
44730 }
44731
44732 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
44733         LDKTxAddInput this_ptr_conv;
44734         this_ptr_conv.inner = untag_ptr(this_ptr);
44735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44737         this_ptr_conv.is_owned = false;
44738         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
44739         return ret_conv;
44740 }
44741
44742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44743         LDKTxAddInput this_ptr_conv;
44744         this_ptr_conv.inner = untag_ptr(this_ptr);
44745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44747         this_ptr_conv.is_owned = false;
44748         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
44749 }
44750
44751 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
44752         LDKTxAddInput this_ptr_conv;
44753         this_ptr_conv.inner = untag_ptr(this_ptr);
44754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44756         this_ptr_conv.is_owned = false;
44757         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
44758         return ret_conv;
44759 }
44760
44761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44762         LDKTxAddInput this_ptr_conv;
44763         this_ptr_conv.inner = untag_ptr(this_ptr);
44764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44766         this_ptr_conv.is_owned = false;
44767         TxAddInput_set_sequence(&this_ptr_conv, val);
44768 }
44769
44770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
44771         LDKThirtyTwoBytes channel_id_arg_ref;
44772         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44773         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44774         LDKTransactionU16LenLimited prevtx_arg_conv;
44775         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
44776         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
44777         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
44778         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
44779         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
44780         int64_t ret_ref = 0;
44781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44783         return ret_ref;
44784 }
44785
44786 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
44787         LDKTxAddInput ret_var = TxAddInput_clone(arg);
44788         int64_t ret_ref = 0;
44789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44791         return ret_ref;
44792 }
44793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44794         LDKTxAddInput arg_conv;
44795         arg_conv.inner = untag_ptr(arg);
44796         arg_conv.is_owned = ptr_is_owned(arg);
44797         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44798         arg_conv.is_owned = false;
44799         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
44800         return ret_conv;
44801 }
44802
44803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44804         LDKTxAddInput orig_conv;
44805         orig_conv.inner = untag_ptr(orig);
44806         orig_conv.is_owned = ptr_is_owned(orig);
44807         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44808         orig_conv.is_owned = false;
44809         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
44810         int64_t ret_ref = 0;
44811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44813         return ret_ref;
44814 }
44815
44816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44817         LDKTxAddInput a_conv;
44818         a_conv.inner = untag_ptr(a);
44819         a_conv.is_owned = ptr_is_owned(a);
44820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44821         a_conv.is_owned = false;
44822         LDKTxAddInput b_conv;
44823         b_conv.inner = untag_ptr(b);
44824         b_conv.is_owned = ptr_is_owned(b);
44825         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44826         b_conv.is_owned = false;
44827         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
44828         return ret_conv;
44829 }
44830
44831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44832         LDKTxAddOutput this_obj_conv;
44833         this_obj_conv.inner = untag_ptr(this_obj);
44834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44836         TxAddOutput_free(this_obj_conv);
44837 }
44838
44839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44840         LDKTxAddOutput this_ptr_conv;
44841         this_ptr_conv.inner = untag_ptr(this_ptr);
44842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44844         this_ptr_conv.is_owned = false;
44845         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44846         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddOutput_get_channel_id(&this_ptr_conv));
44847         return ret_arr;
44848 }
44849
44850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44851         LDKTxAddOutput this_ptr_conv;
44852         this_ptr_conv.inner = untag_ptr(this_ptr);
44853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44855         this_ptr_conv.is_owned = false;
44856         LDKThirtyTwoBytes val_ref;
44857         CHECK((*env)->GetArrayLength(env, val) == 32);
44858         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44859         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
44860 }
44861
44862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44863         LDKTxAddOutput this_ptr_conv;
44864         this_ptr_conv.inner = untag_ptr(this_ptr);
44865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44867         this_ptr_conv.is_owned = false;
44868         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
44869         return ret_conv;
44870 }
44871
44872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44873         LDKTxAddOutput this_ptr_conv;
44874         this_ptr_conv.inner = untag_ptr(this_ptr);
44875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44877         this_ptr_conv.is_owned = false;
44878         TxAddOutput_set_serial_id(&this_ptr_conv, val);
44879 }
44880
44881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
44882         LDKTxAddOutput this_ptr_conv;
44883         this_ptr_conv.inner = untag_ptr(this_ptr);
44884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44886         this_ptr_conv.is_owned = false;
44887         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
44888         return ret_conv;
44889 }
44890
44891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44892         LDKTxAddOutput this_ptr_conv;
44893         this_ptr_conv.inner = untag_ptr(this_ptr);
44894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44896         this_ptr_conv.is_owned = false;
44897         TxAddOutput_set_sats(&this_ptr_conv, val);
44898 }
44899
44900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
44901         LDKTxAddOutput this_ptr_conv;
44902         this_ptr_conv.inner = untag_ptr(this_ptr);
44903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44905         this_ptr_conv.is_owned = false;
44906         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
44907         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44908         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44909         return ret_arr;
44910 }
44911
44912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44913         LDKTxAddOutput this_ptr_conv;
44914         this_ptr_conv.inner = untag_ptr(this_ptr);
44915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44917         this_ptr_conv.is_owned = false;
44918         LDKCVec_u8Z val_ref;
44919         val_ref.datalen = (*env)->GetArrayLength(env, val);
44920         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44921         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
44922         TxAddOutput_set_script(&this_ptr_conv, val_ref);
44923 }
44924
44925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
44926         LDKThirtyTwoBytes channel_id_arg_ref;
44927         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44928         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44929         LDKCVec_u8Z script_arg_ref;
44930         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
44931         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44932         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
44933         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
44934         int64_t ret_ref = 0;
44935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44937         return ret_ref;
44938 }
44939
44940 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
44941         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
44942         int64_t ret_ref = 0;
44943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44945         return ret_ref;
44946 }
44947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44948         LDKTxAddOutput arg_conv;
44949         arg_conv.inner = untag_ptr(arg);
44950         arg_conv.is_owned = ptr_is_owned(arg);
44951         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44952         arg_conv.is_owned = false;
44953         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
44954         return ret_conv;
44955 }
44956
44957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44958         LDKTxAddOutput orig_conv;
44959         orig_conv.inner = untag_ptr(orig);
44960         orig_conv.is_owned = ptr_is_owned(orig);
44961         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44962         orig_conv.is_owned = false;
44963         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
44964         int64_t ret_ref = 0;
44965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44967         return ret_ref;
44968 }
44969
44970 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44971         LDKTxAddOutput a_conv;
44972         a_conv.inner = untag_ptr(a);
44973         a_conv.is_owned = ptr_is_owned(a);
44974         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44975         a_conv.is_owned = false;
44976         LDKTxAddOutput b_conv;
44977         b_conv.inner = untag_ptr(b);
44978         b_conv.is_owned = ptr_is_owned(b);
44979         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44980         b_conv.is_owned = false;
44981         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
44982         return ret_conv;
44983 }
44984
44985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44986         LDKTxRemoveInput this_obj_conv;
44987         this_obj_conv.inner = untag_ptr(this_obj);
44988         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44990         TxRemoveInput_free(this_obj_conv);
44991 }
44992
44993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44994         LDKTxRemoveInput this_ptr_conv;
44995         this_ptr_conv.inner = untag_ptr(this_ptr);
44996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44998         this_ptr_conv.is_owned = false;
44999         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45000         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveInput_get_channel_id(&this_ptr_conv));
45001         return ret_arr;
45002 }
45003
45004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45005         LDKTxRemoveInput this_ptr_conv;
45006         this_ptr_conv.inner = untag_ptr(this_ptr);
45007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45009         this_ptr_conv.is_owned = false;
45010         LDKThirtyTwoBytes val_ref;
45011         CHECK((*env)->GetArrayLength(env, val) == 32);
45012         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45013         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
45014 }
45015
45016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45017         LDKTxRemoveInput this_ptr_conv;
45018         this_ptr_conv.inner = untag_ptr(this_ptr);
45019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45021         this_ptr_conv.is_owned = false;
45022         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
45023         return ret_conv;
45024 }
45025
45026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45027         LDKTxRemoveInput this_ptr_conv;
45028         this_ptr_conv.inner = untag_ptr(this_ptr);
45029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45031         this_ptr_conv.is_owned = false;
45032         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
45033 }
45034
45035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
45036         LDKThirtyTwoBytes channel_id_arg_ref;
45037         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45038         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45039         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
45040         int64_t ret_ref = 0;
45041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45043         return ret_ref;
45044 }
45045
45046 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
45047         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
45048         int64_t ret_ref = 0;
45049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45051         return ret_ref;
45052 }
45053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45054         LDKTxRemoveInput arg_conv;
45055         arg_conv.inner = untag_ptr(arg);
45056         arg_conv.is_owned = ptr_is_owned(arg);
45057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45058         arg_conv.is_owned = false;
45059         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
45060         return ret_conv;
45061 }
45062
45063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45064         LDKTxRemoveInput orig_conv;
45065         orig_conv.inner = untag_ptr(orig);
45066         orig_conv.is_owned = ptr_is_owned(orig);
45067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45068         orig_conv.is_owned = false;
45069         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
45070         int64_t ret_ref = 0;
45071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45073         return ret_ref;
45074 }
45075
45076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45077         LDKTxRemoveInput a_conv;
45078         a_conv.inner = untag_ptr(a);
45079         a_conv.is_owned = ptr_is_owned(a);
45080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45081         a_conv.is_owned = false;
45082         LDKTxRemoveInput b_conv;
45083         b_conv.inner = untag_ptr(b);
45084         b_conv.is_owned = ptr_is_owned(b);
45085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45086         b_conv.is_owned = false;
45087         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
45088         return ret_conv;
45089 }
45090
45091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45092         LDKTxRemoveOutput this_obj_conv;
45093         this_obj_conv.inner = untag_ptr(this_obj);
45094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45096         TxRemoveOutput_free(this_obj_conv);
45097 }
45098
45099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45100         LDKTxRemoveOutput this_ptr_conv;
45101         this_ptr_conv.inner = untag_ptr(this_ptr);
45102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45104         this_ptr_conv.is_owned = false;
45105         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45106         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveOutput_get_channel_id(&this_ptr_conv));
45107         return ret_arr;
45108 }
45109
45110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45111         LDKTxRemoveOutput this_ptr_conv;
45112         this_ptr_conv.inner = untag_ptr(this_ptr);
45113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45115         this_ptr_conv.is_owned = false;
45116         LDKThirtyTwoBytes val_ref;
45117         CHECK((*env)->GetArrayLength(env, val) == 32);
45118         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45119         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
45120 }
45121
45122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45123         LDKTxRemoveOutput this_ptr_conv;
45124         this_ptr_conv.inner = untag_ptr(this_ptr);
45125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45127         this_ptr_conv.is_owned = false;
45128         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
45129         return ret_conv;
45130 }
45131
45132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45133         LDKTxRemoveOutput this_ptr_conv;
45134         this_ptr_conv.inner = untag_ptr(this_ptr);
45135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45137         this_ptr_conv.is_owned = false;
45138         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
45139 }
45140
45141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
45142         LDKThirtyTwoBytes channel_id_arg_ref;
45143         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45144         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45145         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
45146         int64_t ret_ref = 0;
45147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45149         return ret_ref;
45150 }
45151
45152 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
45153         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
45154         int64_t ret_ref = 0;
45155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45157         return ret_ref;
45158 }
45159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45160         LDKTxRemoveOutput arg_conv;
45161         arg_conv.inner = untag_ptr(arg);
45162         arg_conv.is_owned = ptr_is_owned(arg);
45163         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45164         arg_conv.is_owned = false;
45165         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
45166         return ret_conv;
45167 }
45168
45169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45170         LDKTxRemoveOutput orig_conv;
45171         orig_conv.inner = untag_ptr(orig);
45172         orig_conv.is_owned = ptr_is_owned(orig);
45173         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45174         orig_conv.is_owned = false;
45175         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
45176         int64_t ret_ref = 0;
45177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45179         return ret_ref;
45180 }
45181
45182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45183         LDKTxRemoveOutput a_conv;
45184         a_conv.inner = untag_ptr(a);
45185         a_conv.is_owned = ptr_is_owned(a);
45186         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45187         a_conv.is_owned = false;
45188         LDKTxRemoveOutput b_conv;
45189         b_conv.inner = untag_ptr(b);
45190         b_conv.is_owned = ptr_is_owned(b);
45191         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45192         b_conv.is_owned = false;
45193         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
45194         return ret_conv;
45195 }
45196
45197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45198         LDKTxComplete this_obj_conv;
45199         this_obj_conv.inner = untag_ptr(this_obj);
45200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45202         TxComplete_free(this_obj_conv);
45203 }
45204
45205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45206         LDKTxComplete this_ptr_conv;
45207         this_ptr_conv.inner = untag_ptr(this_ptr);
45208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45210         this_ptr_conv.is_owned = false;
45211         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45212         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxComplete_get_channel_id(&this_ptr_conv));
45213         return ret_arr;
45214 }
45215
45216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45217         LDKTxComplete this_ptr_conv;
45218         this_ptr_conv.inner = untag_ptr(this_ptr);
45219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45221         this_ptr_conv.is_owned = false;
45222         LDKThirtyTwoBytes val_ref;
45223         CHECK((*env)->GetArrayLength(env, val) == 32);
45224         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45225         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
45226 }
45227
45228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
45229         LDKThirtyTwoBytes channel_id_arg_ref;
45230         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45231         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45232         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
45233         int64_t ret_ref = 0;
45234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45236         return ret_ref;
45237 }
45238
45239 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
45240         LDKTxComplete ret_var = TxComplete_clone(arg);
45241         int64_t ret_ref = 0;
45242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45244         return ret_ref;
45245 }
45246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45247         LDKTxComplete arg_conv;
45248         arg_conv.inner = untag_ptr(arg);
45249         arg_conv.is_owned = ptr_is_owned(arg);
45250         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45251         arg_conv.is_owned = false;
45252         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
45253         return ret_conv;
45254 }
45255
45256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45257         LDKTxComplete orig_conv;
45258         orig_conv.inner = untag_ptr(orig);
45259         orig_conv.is_owned = ptr_is_owned(orig);
45260         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45261         orig_conv.is_owned = false;
45262         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
45263         int64_t ret_ref = 0;
45264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45266         return ret_ref;
45267 }
45268
45269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45270         LDKTxComplete a_conv;
45271         a_conv.inner = untag_ptr(a);
45272         a_conv.is_owned = ptr_is_owned(a);
45273         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45274         a_conv.is_owned = false;
45275         LDKTxComplete b_conv;
45276         b_conv.inner = untag_ptr(b);
45277         b_conv.is_owned = ptr_is_owned(b);
45278         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45279         b_conv.is_owned = false;
45280         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
45281         return ret_conv;
45282 }
45283
45284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45285         LDKTxSignatures this_obj_conv;
45286         this_obj_conv.inner = untag_ptr(this_obj);
45287         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45289         TxSignatures_free(this_obj_conv);
45290 }
45291
45292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45293         LDKTxSignatures this_ptr_conv;
45294         this_ptr_conv.inner = untag_ptr(this_ptr);
45295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45297         this_ptr_conv.is_owned = false;
45298         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45299         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_channel_id(&this_ptr_conv));
45300         return ret_arr;
45301 }
45302
45303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45304         LDKTxSignatures this_ptr_conv;
45305         this_ptr_conv.inner = untag_ptr(this_ptr);
45306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45308         this_ptr_conv.is_owned = false;
45309         LDKThirtyTwoBytes val_ref;
45310         CHECK((*env)->GetArrayLength(env, val) == 32);
45311         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45312         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
45313 }
45314
45315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
45316         LDKTxSignatures this_ptr_conv;
45317         this_ptr_conv.inner = untag_ptr(this_ptr);
45318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45320         this_ptr_conv.is_owned = false;
45321         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45322         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
45323         return ret_arr;
45324 }
45325
45326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45327         LDKTxSignatures this_ptr_conv;
45328         this_ptr_conv.inner = untag_ptr(this_ptr);
45329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45331         this_ptr_conv.is_owned = false;
45332         LDKThirtyTwoBytes val_ref;
45333         CHECK((*env)->GetArrayLength(env, val) == 32);
45334         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45335         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
45336 }
45337
45338 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
45339         LDKTxSignatures this_ptr_conv;
45340         this_ptr_conv.inner = untag_ptr(this_ptr);
45341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45343         this_ptr_conv.is_owned = false;
45344         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
45345         jobjectArray ret_arr = NULL;
45346         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
45347         ;
45348         for (size_t i = 0; i < ret_var.datalen; i++) {
45349                 LDKWitness ret_conv_8_var = ret_var.data[i];
45350                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
45351                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
45352                 Witness_free(ret_conv_8_var);
45353                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
45354         }
45355         
45356         FREE(ret_var.data);
45357         return ret_arr;
45358 }
45359
45360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
45361         LDKTxSignatures this_ptr_conv;
45362         this_ptr_conv.inner = untag_ptr(this_ptr);
45363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45365         this_ptr_conv.is_owned = false;
45366         LDKCVec_WitnessZ val_constr;
45367         val_constr.datalen = (*env)->GetArrayLength(env, val);
45368         if (val_constr.datalen > 0)
45369                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45370         else
45371                 val_constr.data = NULL;
45372         for (size_t i = 0; i < val_constr.datalen; i++) {
45373                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
45374                 LDKWitness val_conv_8_ref;
45375                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
45376                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
45377                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
45378                 val_conv_8_ref.data_is_owned = true;
45379                 val_constr.data[i] = val_conv_8_ref;
45380         }
45381         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
45382 }
45383
45384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray tx_hash_arg, jobjectArray witnesses_arg) {
45385         LDKThirtyTwoBytes channel_id_arg_ref;
45386         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45387         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45388         LDKThirtyTwoBytes tx_hash_arg_ref;
45389         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
45390         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
45391         LDKCVec_WitnessZ witnesses_arg_constr;
45392         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
45393         if (witnesses_arg_constr.datalen > 0)
45394                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45395         else
45396                 witnesses_arg_constr.data = NULL;
45397         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
45398                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
45399                 LDKWitness witnesses_arg_conv_8_ref;
45400                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
45401                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
45402                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
45403                 witnesses_arg_conv_8_ref.data_is_owned = true;
45404                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
45405         }
45406         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
45407         int64_t ret_ref = 0;
45408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45410         return ret_ref;
45411 }
45412
45413 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
45414         LDKTxSignatures ret_var = TxSignatures_clone(arg);
45415         int64_t ret_ref = 0;
45416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45418         return ret_ref;
45419 }
45420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45421         LDKTxSignatures arg_conv;
45422         arg_conv.inner = untag_ptr(arg);
45423         arg_conv.is_owned = ptr_is_owned(arg);
45424         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45425         arg_conv.is_owned = false;
45426         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
45427         return ret_conv;
45428 }
45429
45430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45431         LDKTxSignatures orig_conv;
45432         orig_conv.inner = untag_ptr(orig);
45433         orig_conv.is_owned = ptr_is_owned(orig);
45434         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45435         orig_conv.is_owned = false;
45436         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
45437         int64_t ret_ref = 0;
45438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45440         return ret_ref;
45441 }
45442
45443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45444         LDKTxSignatures a_conv;
45445         a_conv.inner = untag_ptr(a);
45446         a_conv.is_owned = ptr_is_owned(a);
45447         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45448         a_conv.is_owned = false;
45449         LDKTxSignatures b_conv;
45450         b_conv.inner = untag_ptr(b);
45451         b_conv.is_owned = ptr_is_owned(b);
45452         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45453         b_conv.is_owned = false;
45454         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
45455         return ret_conv;
45456 }
45457
45458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45459         LDKTxInitRbf this_obj_conv;
45460         this_obj_conv.inner = untag_ptr(this_obj);
45461         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45463         TxInitRbf_free(this_obj_conv);
45464 }
45465
45466 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45467         LDKTxInitRbf this_ptr_conv;
45468         this_ptr_conv.inner = untag_ptr(this_ptr);
45469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45471         this_ptr_conv.is_owned = false;
45472         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45473         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxInitRbf_get_channel_id(&this_ptr_conv));
45474         return ret_arr;
45475 }
45476
45477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45478         LDKTxInitRbf this_ptr_conv;
45479         this_ptr_conv.inner = untag_ptr(this_ptr);
45480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45482         this_ptr_conv.is_owned = false;
45483         LDKThirtyTwoBytes val_ref;
45484         CHECK((*env)->GetArrayLength(env, val) == 32);
45485         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45486         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
45487 }
45488
45489 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
45490         LDKTxInitRbf this_ptr_conv;
45491         this_ptr_conv.inner = untag_ptr(this_ptr);
45492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45494         this_ptr_conv.is_owned = false;
45495         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
45496         return ret_conv;
45497 }
45498
45499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45500         LDKTxInitRbf this_ptr_conv;
45501         this_ptr_conv.inner = untag_ptr(this_ptr);
45502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45504         this_ptr_conv.is_owned = false;
45505         TxInitRbf_set_locktime(&this_ptr_conv, val);
45506 }
45507
45508 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
45509         LDKTxInitRbf this_ptr_conv;
45510         this_ptr_conv.inner = untag_ptr(this_ptr);
45511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45513         this_ptr_conv.is_owned = false;
45514         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
45515         return ret_conv;
45516 }
45517
45518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45519         LDKTxInitRbf this_ptr_conv;
45520         this_ptr_conv.inner = untag_ptr(this_ptr);
45521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45523         this_ptr_conv.is_owned = false;
45524         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45525 }
45526
45527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
45528         LDKTxInitRbf this_ptr_conv;
45529         this_ptr_conv.inner = untag_ptr(this_ptr);
45530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45532         this_ptr_conv.is_owned = false;
45533         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45534         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
45535         int64_t ret_ref = tag_ptr(ret_copy, true);
45536         return ret_ref;
45537 }
45538
45539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45540         LDKTxInitRbf this_ptr_conv;
45541         this_ptr_conv.inner = untag_ptr(this_ptr);
45542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45544         this_ptr_conv.is_owned = false;
45545         void* val_ptr = untag_ptr(val);
45546         CHECK_ACCESS(val_ptr);
45547         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45548         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45549         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45550 }
45551
45552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
45553         LDKThirtyTwoBytes channel_id_arg_ref;
45554         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45555         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45556         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45557         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45558         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45559         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45560         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
45561         int64_t ret_ref = 0;
45562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45564         return ret_ref;
45565 }
45566
45567 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
45568         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
45569         int64_t ret_ref = 0;
45570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45572         return ret_ref;
45573 }
45574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45575         LDKTxInitRbf arg_conv;
45576         arg_conv.inner = untag_ptr(arg);
45577         arg_conv.is_owned = ptr_is_owned(arg);
45578         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45579         arg_conv.is_owned = false;
45580         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
45581         return ret_conv;
45582 }
45583
45584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45585         LDKTxInitRbf orig_conv;
45586         orig_conv.inner = untag_ptr(orig);
45587         orig_conv.is_owned = ptr_is_owned(orig);
45588         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45589         orig_conv.is_owned = false;
45590         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
45591         int64_t ret_ref = 0;
45592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45594         return ret_ref;
45595 }
45596
45597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45598         LDKTxInitRbf a_conv;
45599         a_conv.inner = untag_ptr(a);
45600         a_conv.is_owned = ptr_is_owned(a);
45601         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45602         a_conv.is_owned = false;
45603         LDKTxInitRbf b_conv;
45604         b_conv.inner = untag_ptr(b);
45605         b_conv.is_owned = ptr_is_owned(b);
45606         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45607         b_conv.is_owned = false;
45608         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
45609         return ret_conv;
45610 }
45611
45612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45613         LDKTxAckRbf this_obj_conv;
45614         this_obj_conv.inner = untag_ptr(this_obj);
45615         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45617         TxAckRbf_free(this_obj_conv);
45618 }
45619
45620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45621         LDKTxAckRbf this_ptr_conv;
45622         this_ptr_conv.inner = untag_ptr(this_ptr);
45623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45625         this_ptr_conv.is_owned = false;
45626         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45627         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAckRbf_get_channel_id(&this_ptr_conv));
45628         return ret_arr;
45629 }
45630
45631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45632         LDKTxAckRbf this_ptr_conv;
45633         this_ptr_conv.inner = untag_ptr(this_ptr);
45634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45636         this_ptr_conv.is_owned = false;
45637         LDKThirtyTwoBytes val_ref;
45638         CHECK((*env)->GetArrayLength(env, val) == 32);
45639         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45640         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
45641 }
45642
45643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
45644         LDKTxAckRbf this_ptr_conv;
45645         this_ptr_conv.inner = untag_ptr(this_ptr);
45646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45648         this_ptr_conv.is_owned = false;
45649         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45650         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
45651         int64_t ret_ref = tag_ptr(ret_copy, true);
45652         return ret_ref;
45653 }
45654
45655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45656         LDKTxAckRbf this_ptr_conv;
45657         this_ptr_conv.inner = untag_ptr(this_ptr);
45658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45660         this_ptr_conv.is_owned = false;
45661         void* val_ptr = untag_ptr(val);
45662         CHECK_ACCESS(val_ptr);
45663         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45664         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45665         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45666 }
45667
45668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t funding_output_contribution_arg) {
45669         LDKThirtyTwoBytes channel_id_arg_ref;
45670         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45671         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45672         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45673         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45674         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45675         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45676         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
45677         int64_t ret_ref = 0;
45678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45680         return ret_ref;
45681 }
45682
45683 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
45684         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
45685         int64_t ret_ref = 0;
45686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45688         return ret_ref;
45689 }
45690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45691         LDKTxAckRbf arg_conv;
45692         arg_conv.inner = untag_ptr(arg);
45693         arg_conv.is_owned = ptr_is_owned(arg);
45694         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45695         arg_conv.is_owned = false;
45696         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
45697         return ret_conv;
45698 }
45699
45700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45701         LDKTxAckRbf orig_conv;
45702         orig_conv.inner = untag_ptr(orig);
45703         orig_conv.is_owned = ptr_is_owned(orig);
45704         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45705         orig_conv.is_owned = false;
45706         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
45707         int64_t ret_ref = 0;
45708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45710         return ret_ref;
45711 }
45712
45713 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45714         LDKTxAckRbf a_conv;
45715         a_conv.inner = untag_ptr(a);
45716         a_conv.is_owned = ptr_is_owned(a);
45717         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45718         a_conv.is_owned = false;
45719         LDKTxAckRbf b_conv;
45720         b_conv.inner = untag_ptr(b);
45721         b_conv.is_owned = ptr_is_owned(b);
45722         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45723         b_conv.is_owned = false;
45724         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
45725         return ret_conv;
45726 }
45727
45728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45729         LDKTxAbort this_obj_conv;
45730         this_obj_conv.inner = untag_ptr(this_obj);
45731         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45733         TxAbort_free(this_obj_conv);
45734 }
45735
45736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45737         LDKTxAbort this_ptr_conv;
45738         this_ptr_conv.inner = untag_ptr(this_ptr);
45739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45741         this_ptr_conv.is_owned = false;
45742         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45743         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAbort_get_channel_id(&this_ptr_conv));
45744         return ret_arr;
45745 }
45746
45747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45748         LDKTxAbort this_ptr_conv;
45749         this_ptr_conv.inner = untag_ptr(this_ptr);
45750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45752         this_ptr_conv.is_owned = false;
45753         LDKThirtyTwoBytes val_ref;
45754         CHECK((*env)->GetArrayLength(env, val) == 32);
45755         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45756         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
45757 }
45758
45759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
45760         LDKTxAbort this_ptr_conv;
45761         this_ptr_conv.inner = untag_ptr(this_ptr);
45762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45764         this_ptr_conv.is_owned = false;
45765         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
45766         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45767         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45768         CVec_u8Z_free(ret_var);
45769         return ret_arr;
45770 }
45771
45772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45773         LDKTxAbort this_ptr_conv;
45774         this_ptr_conv.inner = untag_ptr(this_ptr);
45775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45777         this_ptr_conv.is_owned = false;
45778         LDKCVec_u8Z val_ref;
45779         val_ref.datalen = (*env)->GetArrayLength(env, val);
45780         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45781         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
45782         TxAbort_set_data(&this_ptr_conv, val_ref);
45783 }
45784
45785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
45786         LDKThirtyTwoBytes channel_id_arg_ref;
45787         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45788         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45789         LDKCVec_u8Z data_arg_ref;
45790         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
45791         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45792         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
45793         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
45794         int64_t ret_ref = 0;
45795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45797         return ret_ref;
45798 }
45799
45800 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
45801         LDKTxAbort ret_var = TxAbort_clone(arg);
45802         int64_t ret_ref = 0;
45803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45805         return ret_ref;
45806 }
45807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45808         LDKTxAbort arg_conv;
45809         arg_conv.inner = untag_ptr(arg);
45810         arg_conv.is_owned = ptr_is_owned(arg);
45811         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45812         arg_conv.is_owned = false;
45813         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
45814         return ret_conv;
45815 }
45816
45817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45818         LDKTxAbort orig_conv;
45819         orig_conv.inner = untag_ptr(orig);
45820         orig_conv.is_owned = ptr_is_owned(orig);
45821         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45822         orig_conv.is_owned = false;
45823         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
45824         int64_t ret_ref = 0;
45825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45827         return ret_ref;
45828 }
45829
45830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45831         LDKTxAbort a_conv;
45832         a_conv.inner = untag_ptr(a);
45833         a_conv.is_owned = ptr_is_owned(a);
45834         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45835         a_conv.is_owned = false;
45836         LDKTxAbort b_conv;
45837         b_conv.inner = untag_ptr(b);
45838         b_conv.is_owned = ptr_is_owned(b);
45839         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45840         b_conv.is_owned = false;
45841         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
45842         return ret_conv;
45843 }
45844
45845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45846         LDKShutdown this_obj_conv;
45847         this_obj_conv.inner = untag_ptr(this_obj);
45848         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45850         Shutdown_free(this_obj_conv);
45851 }
45852
45853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45854         LDKShutdown this_ptr_conv;
45855         this_ptr_conv.inner = untag_ptr(this_ptr);
45856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45858         this_ptr_conv.is_owned = false;
45859         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45860         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
45861         return ret_arr;
45862 }
45863
45864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45865         LDKShutdown this_ptr_conv;
45866         this_ptr_conv.inner = untag_ptr(this_ptr);
45867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45869         this_ptr_conv.is_owned = false;
45870         LDKThirtyTwoBytes val_ref;
45871         CHECK((*env)->GetArrayLength(env, val) == 32);
45872         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45873         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
45874 }
45875
45876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
45877         LDKShutdown this_ptr_conv;
45878         this_ptr_conv.inner = untag_ptr(this_ptr);
45879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45881         this_ptr_conv.is_owned = false;
45882         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
45883         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45884         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45885         return ret_arr;
45886 }
45887
45888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45889         LDKShutdown this_ptr_conv;
45890         this_ptr_conv.inner = untag_ptr(this_ptr);
45891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45893         this_ptr_conv.is_owned = false;
45894         LDKCVec_u8Z val_ref;
45895         val_ref.datalen = (*env)->GetArrayLength(env, val);
45896         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45897         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
45898         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
45899 }
45900
45901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
45902         LDKThirtyTwoBytes channel_id_arg_ref;
45903         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45904         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45905         LDKCVec_u8Z scriptpubkey_arg_ref;
45906         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
45907         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45908         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
45909         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
45910         int64_t ret_ref = 0;
45911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45913         return ret_ref;
45914 }
45915
45916 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
45917         LDKShutdown ret_var = Shutdown_clone(arg);
45918         int64_t ret_ref = 0;
45919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45921         return ret_ref;
45922 }
45923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45924         LDKShutdown arg_conv;
45925         arg_conv.inner = untag_ptr(arg);
45926         arg_conv.is_owned = ptr_is_owned(arg);
45927         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45928         arg_conv.is_owned = false;
45929         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
45930         return ret_conv;
45931 }
45932
45933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45934         LDKShutdown orig_conv;
45935         orig_conv.inner = untag_ptr(orig);
45936         orig_conv.is_owned = ptr_is_owned(orig);
45937         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45938         orig_conv.is_owned = false;
45939         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
45940         int64_t ret_ref = 0;
45941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45943         return ret_ref;
45944 }
45945
45946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45947         LDKShutdown a_conv;
45948         a_conv.inner = untag_ptr(a);
45949         a_conv.is_owned = ptr_is_owned(a);
45950         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45951         a_conv.is_owned = false;
45952         LDKShutdown b_conv;
45953         b_conv.inner = untag_ptr(b);
45954         b_conv.is_owned = ptr_is_owned(b);
45955         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45956         b_conv.is_owned = false;
45957         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
45958         return ret_conv;
45959 }
45960
45961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45962         LDKClosingSignedFeeRange this_obj_conv;
45963         this_obj_conv.inner = untag_ptr(this_obj);
45964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45966         ClosingSignedFeeRange_free(this_obj_conv);
45967 }
45968
45969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
45970         LDKClosingSignedFeeRange this_ptr_conv;
45971         this_ptr_conv.inner = untag_ptr(this_ptr);
45972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45974         this_ptr_conv.is_owned = false;
45975         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
45976         return ret_conv;
45977 }
45978
45979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45980         LDKClosingSignedFeeRange this_ptr_conv;
45981         this_ptr_conv.inner = untag_ptr(this_ptr);
45982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45984         this_ptr_conv.is_owned = false;
45985         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
45986 }
45987
45988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
45989         LDKClosingSignedFeeRange this_ptr_conv;
45990         this_ptr_conv.inner = untag_ptr(this_ptr);
45991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45993         this_ptr_conv.is_owned = false;
45994         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
45995         return ret_conv;
45996 }
45997
45998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45999         LDKClosingSignedFeeRange this_ptr_conv;
46000         this_ptr_conv.inner = untag_ptr(this_ptr);
46001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46003         this_ptr_conv.is_owned = false;
46004         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
46005 }
46006
46007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
46008         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
46009         int64_t ret_ref = 0;
46010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46012         return ret_ref;
46013 }
46014
46015 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
46016         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
46017         int64_t ret_ref = 0;
46018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46020         return ret_ref;
46021 }
46022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46023         LDKClosingSignedFeeRange arg_conv;
46024         arg_conv.inner = untag_ptr(arg);
46025         arg_conv.is_owned = ptr_is_owned(arg);
46026         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46027         arg_conv.is_owned = false;
46028         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
46029         return ret_conv;
46030 }
46031
46032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46033         LDKClosingSignedFeeRange orig_conv;
46034         orig_conv.inner = untag_ptr(orig);
46035         orig_conv.is_owned = ptr_is_owned(orig);
46036         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46037         orig_conv.is_owned = false;
46038         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
46039         int64_t ret_ref = 0;
46040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46042         return ret_ref;
46043 }
46044
46045 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46046         LDKClosingSignedFeeRange a_conv;
46047         a_conv.inner = untag_ptr(a);
46048         a_conv.is_owned = ptr_is_owned(a);
46049         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46050         a_conv.is_owned = false;
46051         LDKClosingSignedFeeRange b_conv;
46052         b_conv.inner = untag_ptr(b);
46053         b_conv.is_owned = ptr_is_owned(b);
46054         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46055         b_conv.is_owned = false;
46056         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
46057         return ret_conv;
46058 }
46059
46060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46061         LDKClosingSigned this_obj_conv;
46062         this_obj_conv.inner = untag_ptr(this_obj);
46063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46065         ClosingSigned_free(this_obj_conv);
46066 }
46067
46068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46069         LDKClosingSigned this_ptr_conv;
46070         this_ptr_conv.inner = untag_ptr(this_ptr);
46071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46073         this_ptr_conv.is_owned = false;
46074         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46075         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
46076         return ret_arr;
46077 }
46078
46079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46080         LDKClosingSigned this_ptr_conv;
46081         this_ptr_conv.inner = untag_ptr(this_ptr);
46082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46084         this_ptr_conv.is_owned = false;
46085         LDKThirtyTwoBytes val_ref;
46086         CHECK((*env)->GetArrayLength(env, val) == 32);
46087         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46088         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
46089 }
46090
46091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46092         LDKClosingSigned this_ptr_conv;
46093         this_ptr_conv.inner = untag_ptr(this_ptr);
46094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46096         this_ptr_conv.is_owned = false;
46097         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
46098         return ret_conv;
46099 }
46100
46101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46102         LDKClosingSigned this_ptr_conv;
46103         this_ptr_conv.inner = untag_ptr(this_ptr);
46104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46106         this_ptr_conv.is_owned = false;
46107         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
46108 }
46109
46110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
46111         LDKClosingSigned this_ptr_conv;
46112         this_ptr_conv.inner = untag_ptr(this_ptr);
46113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46115         this_ptr_conv.is_owned = false;
46116         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46117         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
46118         return ret_arr;
46119 }
46120
46121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46122         LDKClosingSigned this_ptr_conv;
46123         this_ptr_conv.inner = untag_ptr(this_ptr);
46124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46126         this_ptr_conv.is_owned = false;
46127         LDKECDSASignature val_ref;
46128         CHECK((*env)->GetArrayLength(env, val) == 64);
46129         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46130         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
46131 }
46132
46133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
46134         LDKClosingSigned this_ptr_conv;
46135         this_ptr_conv.inner = untag_ptr(this_ptr);
46136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46138         this_ptr_conv.is_owned = false;
46139         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
46140         int64_t ret_ref = 0;
46141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46143         return ret_ref;
46144 }
46145
46146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46147         LDKClosingSigned this_ptr_conv;
46148         this_ptr_conv.inner = untag_ptr(this_ptr);
46149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46151         this_ptr_conv.is_owned = false;
46152         LDKClosingSignedFeeRange val_conv;
46153         val_conv.inner = untag_ptr(val);
46154         val_conv.is_owned = ptr_is_owned(val);
46155         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46156         val_conv = ClosingSignedFeeRange_clone(&val_conv);
46157         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
46158 }
46159
46160 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, int64_t fee_range_arg) {
46161         LDKThirtyTwoBytes channel_id_arg_ref;
46162         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46163         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46164         LDKECDSASignature signature_arg_ref;
46165         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
46166         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
46167         LDKClosingSignedFeeRange fee_range_arg_conv;
46168         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
46169         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
46170         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
46171         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
46172         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
46173         int64_t ret_ref = 0;
46174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46176         return ret_ref;
46177 }
46178
46179 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
46180         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
46181         int64_t ret_ref = 0;
46182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46184         return ret_ref;
46185 }
46186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46187         LDKClosingSigned arg_conv;
46188         arg_conv.inner = untag_ptr(arg);
46189         arg_conv.is_owned = ptr_is_owned(arg);
46190         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46191         arg_conv.is_owned = false;
46192         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
46193         return ret_conv;
46194 }
46195
46196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46197         LDKClosingSigned orig_conv;
46198         orig_conv.inner = untag_ptr(orig);
46199         orig_conv.is_owned = ptr_is_owned(orig);
46200         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46201         orig_conv.is_owned = false;
46202         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
46203         int64_t ret_ref = 0;
46204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46206         return ret_ref;
46207 }
46208
46209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46210         LDKClosingSigned a_conv;
46211         a_conv.inner = untag_ptr(a);
46212         a_conv.is_owned = ptr_is_owned(a);
46213         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46214         a_conv.is_owned = false;
46215         LDKClosingSigned b_conv;
46216         b_conv.inner = untag_ptr(b);
46217         b_conv.is_owned = ptr_is_owned(b);
46218         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46219         b_conv.is_owned = false;
46220         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
46221         return ret_conv;
46222 }
46223
46224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46225         LDKUpdateAddHTLC this_obj_conv;
46226         this_obj_conv.inner = untag_ptr(this_obj);
46227         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46229         UpdateAddHTLC_free(this_obj_conv);
46230 }
46231
46232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46233         LDKUpdateAddHTLC this_ptr_conv;
46234         this_ptr_conv.inner = untag_ptr(this_ptr);
46235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46237         this_ptr_conv.is_owned = false;
46238         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46239         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
46240         return ret_arr;
46241 }
46242
46243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46244         LDKUpdateAddHTLC this_ptr_conv;
46245         this_ptr_conv.inner = untag_ptr(this_ptr);
46246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46248         this_ptr_conv.is_owned = false;
46249         LDKThirtyTwoBytes val_ref;
46250         CHECK((*env)->GetArrayLength(env, val) == 32);
46251         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46252         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
46253 }
46254
46255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46256         LDKUpdateAddHTLC this_ptr_conv;
46257         this_ptr_conv.inner = untag_ptr(this_ptr);
46258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46260         this_ptr_conv.is_owned = false;
46261         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
46262         return ret_conv;
46263 }
46264
46265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46266         LDKUpdateAddHTLC this_ptr_conv;
46267         this_ptr_conv.inner = untag_ptr(this_ptr);
46268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46270         this_ptr_conv.is_owned = false;
46271         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
46272 }
46273
46274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46275         LDKUpdateAddHTLC this_ptr_conv;
46276         this_ptr_conv.inner = untag_ptr(this_ptr);
46277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46279         this_ptr_conv.is_owned = false;
46280         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
46281         return ret_conv;
46282 }
46283
46284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46285         LDKUpdateAddHTLC this_ptr_conv;
46286         this_ptr_conv.inner = untag_ptr(this_ptr);
46287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46289         this_ptr_conv.is_owned = false;
46290         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
46291 }
46292
46293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46294         LDKUpdateAddHTLC this_ptr_conv;
46295         this_ptr_conv.inner = untag_ptr(this_ptr);
46296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46298         this_ptr_conv.is_owned = false;
46299         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46300         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
46301         return ret_arr;
46302 }
46303
46304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46305         LDKUpdateAddHTLC this_ptr_conv;
46306         this_ptr_conv.inner = untag_ptr(this_ptr);
46307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46309         this_ptr_conv.is_owned = false;
46310         LDKThirtyTwoBytes val_ref;
46311         CHECK((*env)->GetArrayLength(env, val) == 32);
46312         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46313         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
46314 }
46315
46316 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
46317         LDKUpdateAddHTLC this_ptr_conv;
46318         this_ptr_conv.inner = untag_ptr(this_ptr);
46319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46321         this_ptr_conv.is_owned = false;
46322         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
46323         return ret_conv;
46324 }
46325
46326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46327         LDKUpdateAddHTLC this_ptr_conv;
46328         this_ptr_conv.inner = untag_ptr(this_ptr);
46329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46331         this_ptr_conv.is_owned = false;
46332         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
46333 }
46334
46335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46336         LDKUpdateAddHTLC this_ptr_conv;
46337         this_ptr_conv.inner = untag_ptr(this_ptr);
46338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46340         this_ptr_conv.is_owned = false;
46341         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46342         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
46343         int64_t ret_ref = tag_ptr(ret_copy, true);
46344         return ret_ref;
46345 }
46346
46347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46348         LDKUpdateAddHTLC this_ptr_conv;
46349         this_ptr_conv.inner = untag_ptr(this_ptr);
46350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46352         this_ptr_conv.is_owned = false;
46353         void* val_ptr = untag_ptr(val);
46354         CHECK_ACCESS(val_ptr);
46355         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46356         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46357         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46358 }
46359
46360 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
46361         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
46362         int64_t ret_ref = 0;
46363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46365         return ret_ref;
46366 }
46367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46368         LDKUpdateAddHTLC arg_conv;
46369         arg_conv.inner = untag_ptr(arg);
46370         arg_conv.is_owned = ptr_is_owned(arg);
46371         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46372         arg_conv.is_owned = false;
46373         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
46374         return ret_conv;
46375 }
46376
46377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46378         LDKUpdateAddHTLC orig_conv;
46379         orig_conv.inner = untag_ptr(orig);
46380         orig_conv.is_owned = ptr_is_owned(orig);
46381         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46382         orig_conv.is_owned = false;
46383         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
46384         int64_t ret_ref = 0;
46385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46387         return ret_ref;
46388 }
46389
46390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46391         LDKUpdateAddHTLC a_conv;
46392         a_conv.inner = untag_ptr(a);
46393         a_conv.is_owned = ptr_is_owned(a);
46394         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46395         a_conv.is_owned = false;
46396         LDKUpdateAddHTLC b_conv;
46397         b_conv.inner = untag_ptr(b);
46398         b_conv.is_owned = ptr_is_owned(b);
46399         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46400         b_conv.is_owned = false;
46401         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
46402         return ret_conv;
46403 }
46404
46405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46406         LDKOnionMessage this_obj_conv;
46407         this_obj_conv.inner = untag_ptr(this_obj);
46408         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46410         OnionMessage_free(this_obj_conv);
46411 }
46412
46413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
46414         LDKOnionMessage this_ptr_conv;
46415         this_ptr_conv.inner = untag_ptr(this_ptr);
46416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46418         this_ptr_conv.is_owned = false;
46419         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46420         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
46421         return ret_arr;
46422 }
46423
46424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46425         LDKOnionMessage this_ptr_conv;
46426         this_ptr_conv.inner = untag_ptr(this_ptr);
46427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46429         this_ptr_conv.is_owned = false;
46430         LDKPublicKey val_ref;
46431         CHECK((*env)->GetArrayLength(env, val) == 33);
46432         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46433         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
46434 }
46435
46436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
46437         LDKOnionMessage this_ptr_conv;
46438         this_ptr_conv.inner = untag_ptr(this_ptr);
46439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46441         this_ptr_conv.is_owned = false;
46442         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
46443         int64_t ret_ref = 0;
46444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46446         return ret_ref;
46447 }
46448
46449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46450         LDKOnionMessage this_ptr_conv;
46451         this_ptr_conv.inner = untag_ptr(this_ptr);
46452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46454         this_ptr_conv.is_owned = false;
46455         LDKPacket val_conv;
46456         val_conv.inner = untag_ptr(val);
46457         val_conv.is_owned = ptr_is_owned(val);
46458         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46459         val_conv = Packet_clone(&val_conv);
46460         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
46461 }
46462
46463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1new(JNIEnv *env, jclass clz, int8_tArray blinding_point_arg, int64_t onion_routing_packet_arg) {
46464         LDKPublicKey blinding_point_arg_ref;
46465         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
46466         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
46467         LDKPacket onion_routing_packet_arg_conv;
46468         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46469         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46470         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46471         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
46472         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
46473         int64_t ret_ref = 0;
46474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46476         return ret_ref;
46477 }
46478
46479 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
46480         LDKOnionMessage ret_var = OnionMessage_clone(arg);
46481         int64_t ret_ref = 0;
46482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46484         return ret_ref;
46485 }
46486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46487         LDKOnionMessage arg_conv;
46488         arg_conv.inner = untag_ptr(arg);
46489         arg_conv.is_owned = ptr_is_owned(arg);
46490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46491         arg_conv.is_owned = false;
46492         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
46493         return ret_conv;
46494 }
46495
46496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46497         LDKOnionMessage orig_conv;
46498         orig_conv.inner = untag_ptr(orig);
46499         orig_conv.is_owned = ptr_is_owned(orig);
46500         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46501         orig_conv.is_owned = false;
46502         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
46503         int64_t ret_ref = 0;
46504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46506         return ret_ref;
46507 }
46508
46509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46510         LDKOnionMessage a_conv;
46511         a_conv.inner = untag_ptr(a);
46512         a_conv.is_owned = ptr_is_owned(a);
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46514         a_conv.is_owned = false;
46515         LDKOnionMessage b_conv;
46516         b_conv.inner = untag_ptr(b);
46517         b_conv.is_owned = ptr_is_owned(b);
46518         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46519         b_conv.is_owned = false;
46520         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
46521         return ret_conv;
46522 }
46523
46524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46525         LDKUpdateFulfillHTLC this_obj_conv;
46526         this_obj_conv.inner = untag_ptr(this_obj);
46527         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46529         UpdateFulfillHTLC_free(this_obj_conv);
46530 }
46531
46532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46533         LDKUpdateFulfillHTLC this_ptr_conv;
46534         this_ptr_conv.inner = untag_ptr(this_ptr);
46535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46537         this_ptr_conv.is_owned = false;
46538         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46539         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
46540         return ret_arr;
46541 }
46542
46543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46544         LDKUpdateFulfillHTLC this_ptr_conv;
46545         this_ptr_conv.inner = untag_ptr(this_ptr);
46546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46548         this_ptr_conv.is_owned = false;
46549         LDKThirtyTwoBytes val_ref;
46550         CHECK((*env)->GetArrayLength(env, val) == 32);
46551         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46552         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
46553 }
46554
46555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46556         LDKUpdateFulfillHTLC this_ptr_conv;
46557         this_ptr_conv.inner = untag_ptr(this_ptr);
46558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46560         this_ptr_conv.is_owned = false;
46561         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
46562         return ret_conv;
46563 }
46564
46565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46566         LDKUpdateFulfillHTLC this_ptr_conv;
46567         this_ptr_conv.inner = untag_ptr(this_ptr);
46568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46570         this_ptr_conv.is_owned = false;
46571         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
46572 }
46573
46574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
46575         LDKUpdateFulfillHTLC this_ptr_conv;
46576         this_ptr_conv.inner = untag_ptr(this_ptr);
46577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46579         this_ptr_conv.is_owned = false;
46580         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46581         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
46582         return ret_arr;
46583 }
46584
46585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46586         LDKUpdateFulfillHTLC this_ptr_conv;
46587         this_ptr_conv.inner = untag_ptr(this_ptr);
46588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46590         this_ptr_conv.is_owned = false;
46591         LDKThirtyTwoBytes val_ref;
46592         CHECK((*env)->GetArrayLength(env, val) == 32);
46593         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46594         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
46595 }
46596
46597 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) {
46598         LDKThirtyTwoBytes channel_id_arg_ref;
46599         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46600         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46601         LDKThirtyTwoBytes payment_preimage_arg_ref;
46602         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
46603         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
46604         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
46605         int64_t ret_ref = 0;
46606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46608         return ret_ref;
46609 }
46610
46611 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
46612         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
46613         int64_t ret_ref = 0;
46614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46616         return ret_ref;
46617 }
46618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46619         LDKUpdateFulfillHTLC arg_conv;
46620         arg_conv.inner = untag_ptr(arg);
46621         arg_conv.is_owned = ptr_is_owned(arg);
46622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46623         arg_conv.is_owned = false;
46624         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
46625         return ret_conv;
46626 }
46627
46628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46629         LDKUpdateFulfillHTLC orig_conv;
46630         orig_conv.inner = untag_ptr(orig);
46631         orig_conv.is_owned = ptr_is_owned(orig);
46632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46633         orig_conv.is_owned = false;
46634         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
46635         int64_t ret_ref = 0;
46636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46638         return ret_ref;
46639 }
46640
46641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46642         LDKUpdateFulfillHTLC a_conv;
46643         a_conv.inner = untag_ptr(a);
46644         a_conv.is_owned = ptr_is_owned(a);
46645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46646         a_conv.is_owned = false;
46647         LDKUpdateFulfillHTLC b_conv;
46648         b_conv.inner = untag_ptr(b);
46649         b_conv.is_owned = ptr_is_owned(b);
46650         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46651         b_conv.is_owned = false;
46652         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
46653         return ret_conv;
46654 }
46655
46656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46657         LDKUpdateFailHTLC this_obj_conv;
46658         this_obj_conv.inner = untag_ptr(this_obj);
46659         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46661         UpdateFailHTLC_free(this_obj_conv);
46662 }
46663
46664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46665         LDKUpdateFailHTLC this_ptr_conv;
46666         this_ptr_conv.inner = untag_ptr(this_ptr);
46667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46669         this_ptr_conv.is_owned = false;
46670         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46671         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
46672         return ret_arr;
46673 }
46674
46675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46676         LDKUpdateFailHTLC this_ptr_conv;
46677         this_ptr_conv.inner = untag_ptr(this_ptr);
46678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46680         this_ptr_conv.is_owned = false;
46681         LDKThirtyTwoBytes val_ref;
46682         CHECK((*env)->GetArrayLength(env, val) == 32);
46683         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46684         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
46685 }
46686
46687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46688         LDKUpdateFailHTLC this_ptr_conv;
46689         this_ptr_conv.inner = untag_ptr(this_ptr);
46690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46692         this_ptr_conv.is_owned = false;
46693         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
46694         return ret_conv;
46695 }
46696
46697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46698         LDKUpdateFailHTLC this_ptr_conv;
46699         this_ptr_conv.inner = untag_ptr(this_ptr);
46700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46702         this_ptr_conv.is_owned = false;
46703         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
46704 }
46705
46706 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
46707         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
46708         int64_t ret_ref = 0;
46709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46711         return ret_ref;
46712 }
46713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46714         LDKUpdateFailHTLC arg_conv;
46715         arg_conv.inner = untag_ptr(arg);
46716         arg_conv.is_owned = ptr_is_owned(arg);
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46718         arg_conv.is_owned = false;
46719         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
46720         return ret_conv;
46721 }
46722
46723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46724         LDKUpdateFailHTLC orig_conv;
46725         orig_conv.inner = untag_ptr(orig);
46726         orig_conv.is_owned = ptr_is_owned(orig);
46727         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46728         orig_conv.is_owned = false;
46729         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
46730         int64_t ret_ref = 0;
46731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46733         return ret_ref;
46734 }
46735
46736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46737         LDKUpdateFailHTLC a_conv;
46738         a_conv.inner = untag_ptr(a);
46739         a_conv.is_owned = ptr_is_owned(a);
46740         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46741         a_conv.is_owned = false;
46742         LDKUpdateFailHTLC b_conv;
46743         b_conv.inner = untag_ptr(b);
46744         b_conv.is_owned = ptr_is_owned(b);
46745         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46746         b_conv.is_owned = false;
46747         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
46748         return ret_conv;
46749 }
46750
46751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46752         LDKUpdateFailMalformedHTLC this_obj_conv;
46753         this_obj_conv.inner = untag_ptr(this_obj);
46754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46756         UpdateFailMalformedHTLC_free(this_obj_conv);
46757 }
46758
46759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46760         LDKUpdateFailMalformedHTLC this_ptr_conv;
46761         this_ptr_conv.inner = untag_ptr(this_ptr);
46762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46764         this_ptr_conv.is_owned = false;
46765         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46766         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
46767         return ret_arr;
46768 }
46769
46770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46771         LDKUpdateFailMalformedHTLC this_ptr_conv;
46772         this_ptr_conv.inner = untag_ptr(this_ptr);
46773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46775         this_ptr_conv.is_owned = false;
46776         LDKThirtyTwoBytes val_ref;
46777         CHECK((*env)->GetArrayLength(env, val) == 32);
46778         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46779         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
46780 }
46781
46782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46783         LDKUpdateFailMalformedHTLC this_ptr_conv;
46784         this_ptr_conv.inner = untag_ptr(this_ptr);
46785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46787         this_ptr_conv.is_owned = false;
46788         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
46789         return ret_conv;
46790 }
46791
46792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46793         LDKUpdateFailMalformedHTLC this_ptr_conv;
46794         this_ptr_conv.inner = untag_ptr(this_ptr);
46795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46797         this_ptr_conv.is_owned = false;
46798         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
46799 }
46800
46801 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
46802         LDKUpdateFailMalformedHTLC this_ptr_conv;
46803         this_ptr_conv.inner = untag_ptr(this_ptr);
46804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46806         this_ptr_conv.is_owned = false;
46807         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
46808         return ret_conv;
46809 }
46810
46811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46812         LDKUpdateFailMalformedHTLC this_ptr_conv;
46813         this_ptr_conv.inner = untag_ptr(this_ptr);
46814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46816         this_ptr_conv.is_owned = false;
46817         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
46818 }
46819
46820 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
46821         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
46822         int64_t ret_ref = 0;
46823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46825         return ret_ref;
46826 }
46827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46828         LDKUpdateFailMalformedHTLC arg_conv;
46829         arg_conv.inner = untag_ptr(arg);
46830         arg_conv.is_owned = ptr_is_owned(arg);
46831         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46832         arg_conv.is_owned = false;
46833         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
46834         return ret_conv;
46835 }
46836
46837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46838         LDKUpdateFailMalformedHTLC orig_conv;
46839         orig_conv.inner = untag_ptr(orig);
46840         orig_conv.is_owned = ptr_is_owned(orig);
46841         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46842         orig_conv.is_owned = false;
46843         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
46844         int64_t ret_ref = 0;
46845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46847         return ret_ref;
46848 }
46849
46850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46851         LDKUpdateFailMalformedHTLC a_conv;
46852         a_conv.inner = untag_ptr(a);
46853         a_conv.is_owned = ptr_is_owned(a);
46854         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46855         a_conv.is_owned = false;
46856         LDKUpdateFailMalformedHTLC b_conv;
46857         b_conv.inner = untag_ptr(b);
46858         b_conv.is_owned = ptr_is_owned(b);
46859         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46860         b_conv.is_owned = false;
46861         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
46862         return ret_conv;
46863 }
46864
46865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46866         LDKCommitmentSigned this_obj_conv;
46867         this_obj_conv.inner = untag_ptr(this_obj);
46868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46870         CommitmentSigned_free(this_obj_conv);
46871 }
46872
46873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46874         LDKCommitmentSigned this_ptr_conv;
46875         this_ptr_conv.inner = untag_ptr(this_ptr);
46876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46878         this_ptr_conv.is_owned = false;
46879         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46880         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
46881         return ret_arr;
46882 }
46883
46884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46885         LDKCommitmentSigned this_ptr_conv;
46886         this_ptr_conv.inner = untag_ptr(this_ptr);
46887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46889         this_ptr_conv.is_owned = false;
46890         LDKThirtyTwoBytes val_ref;
46891         CHECK((*env)->GetArrayLength(env, val) == 32);
46892         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46893         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
46894 }
46895
46896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
46897         LDKCommitmentSigned this_ptr_conv;
46898         this_ptr_conv.inner = untag_ptr(this_ptr);
46899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46901         this_ptr_conv.is_owned = false;
46902         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46903         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
46904         return ret_arr;
46905 }
46906
46907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46908         LDKCommitmentSigned this_ptr_conv;
46909         this_ptr_conv.inner = untag_ptr(this_ptr);
46910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46912         this_ptr_conv.is_owned = false;
46913         LDKECDSASignature val_ref;
46914         CHECK((*env)->GetArrayLength(env, val) == 64);
46915         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46916         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
46917 }
46918
46919 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
46920         LDKCommitmentSigned this_ptr_conv;
46921         this_ptr_conv.inner = untag_ptr(this_ptr);
46922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46924         this_ptr_conv.is_owned = false;
46925         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
46926         jobjectArray ret_arr = NULL;
46927         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
46928         ;
46929         for (size_t i = 0; i < ret_var.datalen; i++) {
46930                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
46931                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
46932                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
46933         }
46934         
46935         FREE(ret_var.data);
46936         return ret_arr;
46937 }
46938
46939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
46940         LDKCommitmentSigned this_ptr_conv;
46941         this_ptr_conv.inner = untag_ptr(this_ptr);
46942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46944         this_ptr_conv.is_owned = false;
46945         LDKCVec_ECDSASignatureZ val_constr;
46946         val_constr.datalen = (*env)->GetArrayLength(env, val);
46947         if (val_constr.datalen > 0)
46948                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
46949         else
46950                 val_constr.data = NULL;
46951         for (size_t i = 0; i < val_constr.datalen; i++) {
46952                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
46953                 LDKECDSASignature val_conv_8_ref;
46954                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
46955                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
46956                 val_constr.data[i] = val_conv_8_ref;
46957         }
46958         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
46959 }
46960
46961 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) {
46962         LDKThirtyTwoBytes channel_id_arg_ref;
46963         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46964         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46965         LDKECDSASignature signature_arg_ref;
46966         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
46967         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
46968         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
46969         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
46970         if (htlc_signatures_arg_constr.datalen > 0)
46971                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
46972         else
46973                 htlc_signatures_arg_constr.data = NULL;
46974         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
46975                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
46976                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
46977                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
46978                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
46979                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
46980         }
46981         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
46982         int64_t ret_ref = 0;
46983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46985         return ret_ref;
46986 }
46987
46988 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
46989         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
46990         int64_t ret_ref = 0;
46991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46993         return ret_ref;
46994 }
46995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46996         LDKCommitmentSigned arg_conv;
46997         arg_conv.inner = untag_ptr(arg);
46998         arg_conv.is_owned = ptr_is_owned(arg);
46999         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47000         arg_conv.is_owned = false;
47001         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
47002         return ret_conv;
47003 }
47004
47005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47006         LDKCommitmentSigned orig_conv;
47007         orig_conv.inner = untag_ptr(orig);
47008         orig_conv.is_owned = ptr_is_owned(orig);
47009         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47010         orig_conv.is_owned = false;
47011         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
47012         int64_t ret_ref = 0;
47013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47015         return ret_ref;
47016 }
47017
47018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47019         LDKCommitmentSigned a_conv;
47020         a_conv.inner = untag_ptr(a);
47021         a_conv.is_owned = ptr_is_owned(a);
47022         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47023         a_conv.is_owned = false;
47024         LDKCommitmentSigned b_conv;
47025         b_conv.inner = untag_ptr(b);
47026         b_conv.is_owned = ptr_is_owned(b);
47027         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47028         b_conv.is_owned = false;
47029         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
47030         return ret_conv;
47031 }
47032
47033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47034         LDKRevokeAndACK this_obj_conv;
47035         this_obj_conv.inner = untag_ptr(this_obj);
47036         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47038         RevokeAndACK_free(this_obj_conv);
47039 }
47040
47041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47042         LDKRevokeAndACK this_ptr_conv;
47043         this_ptr_conv.inner = untag_ptr(this_ptr);
47044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47046         this_ptr_conv.is_owned = false;
47047         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47048         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
47049         return ret_arr;
47050 }
47051
47052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47053         LDKRevokeAndACK this_ptr_conv;
47054         this_ptr_conv.inner = untag_ptr(this_ptr);
47055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47057         this_ptr_conv.is_owned = false;
47058         LDKThirtyTwoBytes val_ref;
47059         CHECK((*env)->GetArrayLength(env, val) == 32);
47060         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47061         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
47062 }
47063
47064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
47065         LDKRevokeAndACK this_ptr_conv;
47066         this_ptr_conv.inner = untag_ptr(this_ptr);
47067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47069         this_ptr_conv.is_owned = false;
47070         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47071         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
47072         return ret_arr;
47073 }
47074
47075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47076         LDKRevokeAndACK this_ptr_conv;
47077         this_ptr_conv.inner = untag_ptr(this_ptr);
47078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47080         this_ptr_conv.is_owned = false;
47081         LDKThirtyTwoBytes val_ref;
47082         CHECK((*env)->GetArrayLength(env, val) == 32);
47083         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47084         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
47085 }
47086
47087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47088         LDKRevokeAndACK this_ptr_conv;
47089         this_ptr_conv.inner = untag_ptr(this_ptr);
47090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47092         this_ptr_conv.is_owned = false;
47093         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47094         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
47095         return ret_arr;
47096 }
47097
47098 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) {
47099         LDKRevokeAndACK this_ptr_conv;
47100         this_ptr_conv.inner = untag_ptr(this_ptr);
47101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47103         this_ptr_conv.is_owned = false;
47104         LDKPublicKey val_ref;
47105         CHECK((*env)->GetArrayLength(env, val) == 33);
47106         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47107         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
47108 }
47109
47110 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) {
47111         LDKThirtyTwoBytes channel_id_arg_ref;
47112         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47113         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47114         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
47115         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
47116         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
47117         LDKPublicKey next_per_commitment_point_arg_ref;
47118         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
47119         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
47120         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
47121         int64_t ret_ref = 0;
47122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47124         return ret_ref;
47125 }
47126
47127 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
47128         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
47129         int64_t ret_ref = 0;
47130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47132         return ret_ref;
47133 }
47134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47135         LDKRevokeAndACK arg_conv;
47136         arg_conv.inner = untag_ptr(arg);
47137         arg_conv.is_owned = ptr_is_owned(arg);
47138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47139         arg_conv.is_owned = false;
47140         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
47141         return ret_conv;
47142 }
47143
47144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47145         LDKRevokeAndACK orig_conv;
47146         orig_conv.inner = untag_ptr(orig);
47147         orig_conv.is_owned = ptr_is_owned(orig);
47148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47149         orig_conv.is_owned = false;
47150         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
47151         int64_t ret_ref = 0;
47152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47154         return ret_ref;
47155 }
47156
47157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47158         LDKRevokeAndACK a_conv;
47159         a_conv.inner = untag_ptr(a);
47160         a_conv.is_owned = ptr_is_owned(a);
47161         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47162         a_conv.is_owned = false;
47163         LDKRevokeAndACK b_conv;
47164         b_conv.inner = untag_ptr(b);
47165         b_conv.is_owned = ptr_is_owned(b);
47166         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47167         b_conv.is_owned = false;
47168         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
47169         return ret_conv;
47170 }
47171
47172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47173         LDKUpdateFee this_obj_conv;
47174         this_obj_conv.inner = untag_ptr(this_obj);
47175         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47177         UpdateFee_free(this_obj_conv);
47178 }
47179
47180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47181         LDKUpdateFee this_ptr_conv;
47182         this_ptr_conv.inner = untag_ptr(this_ptr);
47183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47185         this_ptr_conv.is_owned = false;
47186         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47187         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
47188         return ret_arr;
47189 }
47190
47191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47192         LDKUpdateFee this_ptr_conv;
47193         this_ptr_conv.inner = untag_ptr(this_ptr);
47194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47196         this_ptr_conv.is_owned = false;
47197         LDKThirtyTwoBytes val_ref;
47198         CHECK((*env)->GetArrayLength(env, val) == 32);
47199         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47200         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
47201 }
47202
47203 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
47204         LDKUpdateFee this_ptr_conv;
47205         this_ptr_conv.inner = untag_ptr(this_ptr);
47206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47208         this_ptr_conv.is_owned = false;
47209         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
47210         return ret_conv;
47211 }
47212
47213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47214         LDKUpdateFee this_ptr_conv;
47215         this_ptr_conv.inner = untag_ptr(this_ptr);
47216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47218         this_ptr_conv.is_owned = false;
47219         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
47220 }
47221
47222 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) {
47223         LDKThirtyTwoBytes channel_id_arg_ref;
47224         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47225         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47226         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
47227         int64_t ret_ref = 0;
47228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47230         return ret_ref;
47231 }
47232
47233 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
47234         LDKUpdateFee ret_var = UpdateFee_clone(arg);
47235         int64_t ret_ref = 0;
47236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47238         return ret_ref;
47239 }
47240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47241         LDKUpdateFee arg_conv;
47242         arg_conv.inner = untag_ptr(arg);
47243         arg_conv.is_owned = ptr_is_owned(arg);
47244         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47245         arg_conv.is_owned = false;
47246         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
47247         return ret_conv;
47248 }
47249
47250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47251         LDKUpdateFee orig_conv;
47252         orig_conv.inner = untag_ptr(orig);
47253         orig_conv.is_owned = ptr_is_owned(orig);
47254         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47255         orig_conv.is_owned = false;
47256         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
47257         int64_t ret_ref = 0;
47258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47260         return ret_ref;
47261 }
47262
47263 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47264         LDKUpdateFee a_conv;
47265         a_conv.inner = untag_ptr(a);
47266         a_conv.is_owned = ptr_is_owned(a);
47267         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47268         a_conv.is_owned = false;
47269         LDKUpdateFee b_conv;
47270         b_conv.inner = untag_ptr(b);
47271         b_conv.is_owned = ptr_is_owned(b);
47272         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47273         b_conv.is_owned = false;
47274         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
47275         return ret_conv;
47276 }
47277
47278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47279         LDKChannelReestablish this_obj_conv;
47280         this_obj_conv.inner = untag_ptr(this_obj);
47281         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47283         ChannelReestablish_free(this_obj_conv);
47284 }
47285
47286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47287         LDKChannelReestablish this_ptr_conv;
47288         this_ptr_conv.inner = untag_ptr(this_ptr);
47289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47291         this_ptr_conv.is_owned = false;
47292         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47293         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
47294         return ret_arr;
47295 }
47296
47297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47298         LDKChannelReestablish this_ptr_conv;
47299         this_ptr_conv.inner = untag_ptr(this_ptr);
47300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47302         this_ptr_conv.is_owned = false;
47303         LDKThirtyTwoBytes val_ref;
47304         CHECK((*env)->GetArrayLength(env, val) == 32);
47305         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47306         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
47307 }
47308
47309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
47310         LDKChannelReestablish this_ptr_conv;
47311         this_ptr_conv.inner = untag_ptr(this_ptr);
47312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47314         this_ptr_conv.is_owned = false;
47315         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
47316         return ret_conv;
47317 }
47318
47319 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) {
47320         LDKChannelReestablish this_ptr_conv;
47321         this_ptr_conv.inner = untag_ptr(this_ptr);
47322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47324         this_ptr_conv.is_owned = false;
47325         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
47326 }
47327
47328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
47329         LDKChannelReestablish this_ptr_conv;
47330         this_ptr_conv.inner = untag_ptr(this_ptr);
47331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47333         this_ptr_conv.is_owned = false;
47334         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
47335         return ret_conv;
47336 }
47337
47338 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) {
47339         LDKChannelReestablish this_ptr_conv;
47340         this_ptr_conv.inner = untag_ptr(this_ptr);
47341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47343         this_ptr_conv.is_owned = false;
47344         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
47345 }
47346
47347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
47348         LDKChannelReestablish this_ptr_conv;
47349         this_ptr_conv.inner = untag_ptr(this_ptr);
47350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47352         this_ptr_conv.is_owned = false;
47353         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47354         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
47355         return ret_arr;
47356 }
47357
47358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47359         LDKChannelReestablish this_ptr_conv;
47360         this_ptr_conv.inner = untag_ptr(this_ptr);
47361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47363         this_ptr_conv.is_owned = false;
47364         LDKThirtyTwoBytes val_ref;
47365         CHECK((*env)->GetArrayLength(env, val) == 32);
47366         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47367         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
47368 }
47369
47370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47371         LDKChannelReestablish this_ptr_conv;
47372         this_ptr_conv.inner = untag_ptr(this_ptr);
47373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47375         this_ptr_conv.is_owned = false;
47376         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47377         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
47378         return ret_arr;
47379 }
47380
47381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47382         LDKChannelReestablish this_ptr_conv;
47383         this_ptr_conv.inner = untag_ptr(this_ptr);
47384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47386         this_ptr_conv.is_owned = false;
47387         LDKPublicKey val_ref;
47388         CHECK((*env)->GetArrayLength(env, val) == 33);
47389         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47390         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
47391 }
47392
47393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
47394         LDKChannelReestablish this_ptr_conv;
47395         this_ptr_conv.inner = untag_ptr(this_ptr);
47396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47398         this_ptr_conv.is_owned = false;
47399         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
47400         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
47401         int64_t ret_ref = tag_ptr(ret_copy, true);
47402         return ret_ref;
47403 }
47404
47405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47406         LDKChannelReestablish this_ptr_conv;
47407         this_ptr_conv.inner = untag_ptr(this_ptr);
47408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47410         this_ptr_conv.is_owned = false;
47411         void* val_ptr = untag_ptr(val);
47412         CHECK_ACCESS(val_ptr);
47413         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
47414         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
47415         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
47416 }
47417
47418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t next_local_commitment_number_arg, int64_t next_remote_commitment_number_arg, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg, int64_t next_funding_txid_arg) {
47419         LDKThirtyTwoBytes channel_id_arg_ref;
47420         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47421         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47422         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
47423         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
47424         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
47425         LDKPublicKey my_current_per_commitment_point_arg_ref;
47426         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
47427         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
47428         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
47429         CHECK_ACCESS(next_funding_txid_arg_ptr);
47430         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
47431         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
47432         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_ref, next_local_commitment_number_arg, next_remote_commitment_number_arg, your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref, next_funding_txid_arg_conv);
47433         int64_t ret_ref = 0;
47434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47436         return ret_ref;
47437 }
47438
47439 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
47440         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
47441         int64_t ret_ref = 0;
47442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47444         return ret_ref;
47445 }
47446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47447         LDKChannelReestablish arg_conv;
47448         arg_conv.inner = untag_ptr(arg);
47449         arg_conv.is_owned = ptr_is_owned(arg);
47450         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47451         arg_conv.is_owned = false;
47452         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
47453         return ret_conv;
47454 }
47455
47456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47457         LDKChannelReestablish orig_conv;
47458         orig_conv.inner = untag_ptr(orig);
47459         orig_conv.is_owned = ptr_is_owned(orig);
47460         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47461         orig_conv.is_owned = false;
47462         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
47463         int64_t ret_ref = 0;
47464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47466         return ret_ref;
47467 }
47468
47469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47470         LDKChannelReestablish a_conv;
47471         a_conv.inner = untag_ptr(a);
47472         a_conv.is_owned = ptr_is_owned(a);
47473         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47474         a_conv.is_owned = false;
47475         LDKChannelReestablish b_conv;
47476         b_conv.inner = untag_ptr(b);
47477         b_conv.is_owned = ptr_is_owned(b);
47478         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47479         b_conv.is_owned = false;
47480         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
47481         return ret_conv;
47482 }
47483
47484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47485         LDKAnnouncementSignatures this_obj_conv;
47486         this_obj_conv.inner = untag_ptr(this_obj);
47487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47489         AnnouncementSignatures_free(this_obj_conv);
47490 }
47491
47492 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47493         LDKAnnouncementSignatures this_ptr_conv;
47494         this_ptr_conv.inner = untag_ptr(this_ptr);
47495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47497         this_ptr_conv.is_owned = false;
47498         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47499         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
47500         return ret_arr;
47501 }
47502
47503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47504         LDKAnnouncementSignatures this_ptr_conv;
47505         this_ptr_conv.inner = untag_ptr(this_ptr);
47506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47508         this_ptr_conv.is_owned = false;
47509         LDKThirtyTwoBytes val_ref;
47510         CHECK((*env)->GetArrayLength(env, val) == 32);
47511         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47512         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
47513 }
47514
47515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47516         LDKAnnouncementSignatures this_ptr_conv;
47517         this_ptr_conv.inner = untag_ptr(this_ptr);
47518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47520         this_ptr_conv.is_owned = false;
47521         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
47522         return ret_conv;
47523 }
47524
47525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47526         LDKAnnouncementSignatures this_ptr_conv;
47527         this_ptr_conv.inner = untag_ptr(this_ptr);
47528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47530         this_ptr_conv.is_owned = false;
47531         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
47532 }
47533
47534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
47535         LDKAnnouncementSignatures this_ptr_conv;
47536         this_ptr_conv.inner = untag_ptr(this_ptr);
47537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47539         this_ptr_conv.is_owned = false;
47540         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
47541         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
47542         return ret_arr;
47543 }
47544
47545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47546         LDKAnnouncementSignatures this_ptr_conv;
47547         this_ptr_conv.inner = untag_ptr(this_ptr);
47548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47550         this_ptr_conv.is_owned = false;
47551         LDKECDSASignature val_ref;
47552         CHECK((*env)->GetArrayLength(env, val) == 64);
47553         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
47554         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
47555 }
47556
47557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
47558         LDKAnnouncementSignatures this_ptr_conv;
47559         this_ptr_conv.inner = untag_ptr(this_ptr);
47560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47562         this_ptr_conv.is_owned = false;
47563         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
47564         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
47565         return ret_arr;
47566 }
47567
47568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47569         LDKAnnouncementSignatures this_ptr_conv;
47570         this_ptr_conv.inner = untag_ptr(this_ptr);
47571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47573         this_ptr_conv.is_owned = false;
47574         LDKECDSASignature val_ref;
47575         CHECK((*env)->GetArrayLength(env, val) == 64);
47576         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
47577         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
47578 }
47579
47580 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) {
47581         LDKThirtyTwoBytes channel_id_arg_ref;
47582         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47583         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47584         LDKECDSASignature node_signature_arg_ref;
47585         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
47586         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
47587         LDKECDSASignature bitcoin_signature_arg_ref;
47588         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
47589         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
47590         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
47591         int64_t ret_ref = 0;
47592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47594         return ret_ref;
47595 }
47596
47597 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
47598         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
47599         int64_t ret_ref = 0;
47600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47602         return ret_ref;
47603 }
47604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47605         LDKAnnouncementSignatures arg_conv;
47606         arg_conv.inner = untag_ptr(arg);
47607         arg_conv.is_owned = ptr_is_owned(arg);
47608         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47609         arg_conv.is_owned = false;
47610         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
47611         return ret_conv;
47612 }
47613
47614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47615         LDKAnnouncementSignatures orig_conv;
47616         orig_conv.inner = untag_ptr(orig);
47617         orig_conv.is_owned = ptr_is_owned(orig);
47618         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47619         orig_conv.is_owned = false;
47620         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
47621         int64_t ret_ref = 0;
47622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47624         return ret_ref;
47625 }
47626
47627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47628         LDKAnnouncementSignatures a_conv;
47629         a_conv.inner = untag_ptr(a);
47630         a_conv.is_owned = ptr_is_owned(a);
47631         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47632         a_conv.is_owned = false;
47633         LDKAnnouncementSignatures b_conv;
47634         b_conv.inner = untag_ptr(b);
47635         b_conv.is_owned = ptr_is_owned(b);
47636         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47637         b_conv.is_owned = false;
47638         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
47639         return ret_conv;
47640 }
47641
47642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47643         if (!ptr_is_owned(this_ptr)) return;
47644         void* this_ptr_ptr = untag_ptr(this_ptr);
47645         CHECK_ACCESS(this_ptr_ptr);
47646         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
47647         FREE(untag_ptr(this_ptr));
47648         SocketAddress_free(this_ptr_conv);
47649 }
47650
47651 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
47652         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47653         *ret_copy = SocketAddress_clone(arg);
47654         int64_t ret_ref = tag_ptr(ret_copy, true);
47655         return ret_ref;
47656 }
47657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47658         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
47659         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
47660         return ret_conv;
47661 }
47662
47663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47664         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
47665         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47666         *ret_copy = SocketAddress_clone(orig_conv);
47667         int64_t ret_ref = tag_ptr(ret_copy, true);
47668         return ret_ref;
47669 }
47670
47671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
47672         LDKFourBytes addr_ref;
47673         CHECK((*env)->GetArrayLength(env, addr) == 4);
47674         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
47675         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47676         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
47677         int64_t ret_ref = tag_ptr(ret_copy, true);
47678         return ret_ref;
47679 }
47680
47681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
47682         LDKSixteenBytes addr_ref;
47683         CHECK((*env)->GetArrayLength(env, addr) == 16);
47684         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
47685         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47686         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
47687         int64_t ret_ref = tag_ptr(ret_copy, true);
47688         return ret_ref;
47689 }
47690
47691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
47692         LDKTwelveBytes a_ref;
47693         CHECK((*env)->GetArrayLength(env, a) == 12);
47694         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
47695         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47696         *ret_copy = SocketAddress_onion_v2(a_ref);
47697         int64_t ret_ref = tag_ptr(ret_copy, true);
47698         return ret_ref;
47699 }
47700
47701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
47702         LDKThirtyTwoBytes ed25519_pubkey_ref;
47703         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
47704         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
47705         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47706         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
47707         int64_t ret_ref = tag_ptr(ret_copy, true);
47708         return ret_ref;
47709 }
47710
47711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
47712         LDKHostname hostname_conv;
47713         hostname_conv.inner = untag_ptr(hostname);
47714         hostname_conv.is_owned = ptr_is_owned(hostname);
47715         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
47716         hostname_conv = Hostname_clone(&hostname_conv);
47717         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47718         *ret_copy = SocketAddress_hostname(hostname_conv, port);
47719         int64_t ret_ref = tag_ptr(ret_copy, true);
47720         return ret_ref;
47721 }
47722
47723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47724         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
47725         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
47726         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
47727         return ret_conv;
47728 }
47729
47730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SocketAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
47731         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
47732         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
47733         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47734         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47735         CVec_u8Z_free(ret_var);
47736         return ret_arr;
47737 }
47738
47739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
47740         LDKu8slice ser_ref;
47741         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47742         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47743         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
47744         *ret_conv = SocketAddress_read(ser_ref);
47745         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47746         return tag_ptr(ret_conv, true);
47747 }
47748
47749 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47750         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
47751         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_clone(orig_conv));
47752         return ret_conv;
47753 }
47754
47755 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1socket_1addr_1parse(JNIEnv *env, jclass clz) {
47756         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_socket_addr_parse());
47757         return ret_conv;
47758 }
47759
47760 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1input(JNIEnv *env, jclass clz) {
47761         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_input());
47762         return ret_conv;
47763 }
47764
47765 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1port(JNIEnv *env, jclass clz) {
47766         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_port());
47767         return ret_conv;
47768 }
47769
47770 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1onion_1v3(JNIEnv *env, jclass clz) {
47771         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_onion_v3());
47772         return ret_conv;
47773 }
47774
47775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47776         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
47777         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
47778         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
47779         return ret_conv;
47780 }
47781
47782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEnv *env, jclass clz, jstring host, int16_t port) {
47783         LDKStr host_conv = java_to_owned_str(env, host);
47784         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
47785         *ret_conv = parse_onion_address(host_conv, port);
47786         return tag_ptr(ret_conv, true);
47787 }
47788
47789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) {
47790         LDKStr s_conv = java_to_owned_str(env, s);
47791         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
47792         *ret_conv = SocketAddress_from_str(s_conv);
47793         return tag_ptr(ret_conv, true);
47794 }
47795
47796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47797         if (!ptr_is_owned(this_ptr)) return;
47798         void* this_ptr_ptr = untag_ptr(this_ptr);
47799         CHECK_ACCESS(this_ptr_ptr);
47800         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
47801         FREE(untag_ptr(this_ptr));
47802         UnsignedGossipMessage_free(this_ptr_conv);
47803 }
47804
47805 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
47806         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47807         *ret_copy = UnsignedGossipMessage_clone(arg);
47808         int64_t ret_ref = tag_ptr(ret_copy, true);
47809         return ret_ref;
47810 }
47811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47812         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
47813         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
47814         return ret_conv;
47815 }
47816
47817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47818         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
47819         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47820         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
47821         int64_t ret_ref = tag_ptr(ret_copy, true);
47822         return ret_ref;
47823 }
47824
47825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
47826         LDKUnsignedChannelAnnouncement a_conv;
47827         a_conv.inner = untag_ptr(a);
47828         a_conv.is_owned = ptr_is_owned(a);
47829         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47830         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
47831         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47832         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
47833         int64_t ret_ref = tag_ptr(ret_copy, true);
47834         return ret_ref;
47835 }
47836
47837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
47838         LDKUnsignedChannelUpdate a_conv;
47839         a_conv.inner = untag_ptr(a);
47840         a_conv.is_owned = ptr_is_owned(a);
47841         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47842         a_conv = UnsignedChannelUpdate_clone(&a_conv);
47843         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47844         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
47845         int64_t ret_ref = tag_ptr(ret_copy, true);
47846         return ret_ref;
47847 }
47848
47849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
47850         LDKUnsignedNodeAnnouncement a_conv;
47851         a_conv.inner = untag_ptr(a);
47852         a_conv.is_owned = ptr_is_owned(a);
47853         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47854         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
47855         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
47856         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
47857         int64_t ret_ref = tag_ptr(ret_copy, true);
47858         return ret_ref;
47859 }
47860
47861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
47862         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
47863         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
47864         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47865         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47866         CVec_u8Z_free(ret_var);
47867         return ret_arr;
47868 }
47869
47870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47871         LDKUnsignedNodeAnnouncement this_obj_conv;
47872         this_obj_conv.inner = untag_ptr(this_obj);
47873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47875         UnsignedNodeAnnouncement_free(this_obj_conv);
47876 }
47877
47878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
47879         LDKUnsignedNodeAnnouncement this_ptr_conv;
47880         this_ptr_conv.inner = untag_ptr(this_ptr);
47881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47883         this_ptr_conv.is_owned = false;
47884         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
47885         int64_t ret_ref = 0;
47886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47888         return ret_ref;
47889 }
47890
47891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47892         LDKUnsignedNodeAnnouncement this_ptr_conv;
47893         this_ptr_conv.inner = untag_ptr(this_ptr);
47894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47896         this_ptr_conv.is_owned = false;
47897         LDKNodeFeatures val_conv;
47898         val_conv.inner = untag_ptr(val);
47899         val_conv.is_owned = ptr_is_owned(val);
47900         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47901         val_conv = NodeFeatures_clone(&val_conv);
47902         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
47903 }
47904
47905 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
47906         LDKUnsignedNodeAnnouncement this_ptr_conv;
47907         this_ptr_conv.inner = untag_ptr(this_ptr);
47908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47910         this_ptr_conv.is_owned = false;
47911         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
47912         return ret_conv;
47913 }
47914
47915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47916         LDKUnsignedNodeAnnouncement this_ptr_conv;
47917         this_ptr_conv.inner = untag_ptr(this_ptr);
47918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47920         this_ptr_conv.is_owned = false;
47921         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
47922 }
47923
47924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47925         LDKUnsignedNodeAnnouncement this_ptr_conv;
47926         this_ptr_conv.inner = untag_ptr(this_ptr);
47927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47929         this_ptr_conv.is_owned = false;
47930         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
47931         int64_t ret_ref = 0;
47932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47934         return ret_ref;
47935 }
47936
47937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47938         LDKUnsignedNodeAnnouncement this_ptr_conv;
47939         this_ptr_conv.inner = untag_ptr(this_ptr);
47940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47942         this_ptr_conv.is_owned = false;
47943         LDKNodeId val_conv;
47944         val_conv.inner = untag_ptr(val);
47945         val_conv.is_owned = ptr_is_owned(val);
47946         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47947         val_conv = NodeId_clone(&val_conv);
47948         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
47949 }
47950
47951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
47952         LDKUnsignedNodeAnnouncement this_ptr_conv;
47953         this_ptr_conv.inner = untag_ptr(this_ptr);
47954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47956         this_ptr_conv.is_owned = false;
47957         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
47958         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
47959         return ret_arr;
47960 }
47961
47962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47963         LDKUnsignedNodeAnnouncement this_ptr_conv;
47964         this_ptr_conv.inner = untag_ptr(this_ptr);
47965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47967         this_ptr_conv.is_owned = false;
47968         LDKThreeBytes val_ref;
47969         CHECK((*env)->GetArrayLength(env, val) == 3);
47970         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
47971         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
47972 }
47973
47974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
47975         LDKUnsignedNodeAnnouncement this_ptr_conv;
47976         this_ptr_conv.inner = untag_ptr(this_ptr);
47977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47979         this_ptr_conv.is_owned = false;
47980         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
47981         int64_t ret_ref = 0;
47982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47984         return ret_ref;
47985 }
47986
47987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47988         LDKUnsignedNodeAnnouncement this_ptr_conv;
47989         this_ptr_conv.inner = untag_ptr(this_ptr);
47990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47992         this_ptr_conv.is_owned = false;
47993         LDKNodeAlias val_conv;
47994         val_conv.inner = untag_ptr(val);
47995         val_conv.is_owned = ptr_is_owned(val);
47996         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47997         val_conv = NodeAlias_clone(&val_conv);
47998         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
47999 }
48000
48001 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
48002         LDKUnsignedNodeAnnouncement this_ptr_conv;
48003         this_ptr_conv.inner = untag_ptr(this_ptr);
48004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48006         this_ptr_conv.is_owned = false;
48007         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
48008         int64_tArray ret_arr = NULL;
48009         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
48010         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
48011         for (size_t p = 0; p < ret_var.datalen; p++) {
48012                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48013                 *ret_conv_15_copy = ret_var.data[p];
48014                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
48015                 ret_arr_ptr[p] = ret_conv_15_ref;
48016         }
48017         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
48018         FREE(ret_var.data);
48019         return ret_arr;
48020 }
48021
48022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
48023         LDKUnsignedNodeAnnouncement this_ptr_conv;
48024         this_ptr_conv.inner = untag_ptr(this_ptr);
48025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48027         this_ptr_conv.is_owned = false;
48028         LDKCVec_SocketAddressZ val_constr;
48029         val_constr.datalen = (*env)->GetArrayLength(env, val);
48030         if (val_constr.datalen > 0)
48031                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
48032         else
48033                 val_constr.data = NULL;
48034         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
48035         for (size_t p = 0; p < val_constr.datalen; p++) {
48036                 int64_t val_conv_15 = val_vals[p];
48037                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
48038                 CHECK_ACCESS(val_conv_15_ptr);
48039                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
48040                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
48041                 val_constr.data[p] = val_conv_15_conv;
48042         }
48043         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
48044         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
48045 }
48046
48047 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
48048         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
48049         int64_t ret_ref = 0;
48050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48052         return ret_ref;
48053 }
48054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48055         LDKUnsignedNodeAnnouncement arg_conv;
48056         arg_conv.inner = untag_ptr(arg);
48057         arg_conv.is_owned = ptr_is_owned(arg);
48058         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48059         arg_conv.is_owned = false;
48060         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
48061         return ret_conv;
48062 }
48063
48064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48065         LDKUnsignedNodeAnnouncement orig_conv;
48066         orig_conv.inner = untag_ptr(orig);
48067         orig_conv.is_owned = ptr_is_owned(orig);
48068         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48069         orig_conv.is_owned = false;
48070         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
48071         int64_t ret_ref = 0;
48072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48074         return ret_ref;
48075 }
48076
48077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48078         LDKUnsignedNodeAnnouncement a_conv;
48079         a_conv.inner = untag_ptr(a);
48080         a_conv.is_owned = ptr_is_owned(a);
48081         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48082         a_conv.is_owned = false;
48083         LDKUnsignedNodeAnnouncement b_conv;
48084         b_conv.inner = untag_ptr(b);
48085         b_conv.is_owned = ptr_is_owned(b);
48086         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48087         b_conv.is_owned = false;
48088         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
48089         return ret_conv;
48090 }
48091
48092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48093         LDKNodeAnnouncement this_obj_conv;
48094         this_obj_conv.inner = untag_ptr(this_obj);
48095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48097         NodeAnnouncement_free(this_obj_conv);
48098 }
48099
48100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48101         LDKNodeAnnouncement this_ptr_conv;
48102         this_ptr_conv.inner = untag_ptr(this_ptr);
48103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48105         this_ptr_conv.is_owned = false;
48106         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48107         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
48108         return ret_arr;
48109 }
48110
48111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48112         LDKNodeAnnouncement this_ptr_conv;
48113         this_ptr_conv.inner = untag_ptr(this_ptr);
48114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48116         this_ptr_conv.is_owned = false;
48117         LDKECDSASignature val_ref;
48118         CHECK((*env)->GetArrayLength(env, val) == 64);
48119         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48120         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
48121 }
48122
48123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
48124         LDKNodeAnnouncement this_ptr_conv;
48125         this_ptr_conv.inner = untag_ptr(this_ptr);
48126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48128         this_ptr_conv.is_owned = false;
48129         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
48130         int64_t ret_ref = 0;
48131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48133         return ret_ref;
48134 }
48135
48136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48137         LDKNodeAnnouncement this_ptr_conv;
48138         this_ptr_conv.inner = untag_ptr(this_ptr);
48139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48141         this_ptr_conv.is_owned = false;
48142         LDKUnsignedNodeAnnouncement val_conv;
48143         val_conv.inner = untag_ptr(val);
48144         val_conv.is_owned = ptr_is_owned(val);
48145         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48146         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
48147         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
48148 }
48149
48150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
48151         LDKECDSASignature signature_arg_ref;
48152         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
48153         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
48154         LDKUnsignedNodeAnnouncement contents_arg_conv;
48155         contents_arg_conv.inner = untag_ptr(contents_arg);
48156         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48157         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48158         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
48159         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
48160         int64_t ret_ref = 0;
48161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48163         return ret_ref;
48164 }
48165
48166 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
48167         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
48168         int64_t ret_ref = 0;
48169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48171         return ret_ref;
48172 }
48173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48174         LDKNodeAnnouncement arg_conv;
48175         arg_conv.inner = untag_ptr(arg);
48176         arg_conv.is_owned = ptr_is_owned(arg);
48177         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48178         arg_conv.is_owned = false;
48179         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
48180         return ret_conv;
48181 }
48182
48183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48184         LDKNodeAnnouncement orig_conv;
48185         orig_conv.inner = untag_ptr(orig);
48186         orig_conv.is_owned = ptr_is_owned(orig);
48187         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48188         orig_conv.is_owned = false;
48189         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
48190         int64_t ret_ref = 0;
48191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48193         return ret_ref;
48194 }
48195
48196 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48197         LDKNodeAnnouncement a_conv;
48198         a_conv.inner = untag_ptr(a);
48199         a_conv.is_owned = ptr_is_owned(a);
48200         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48201         a_conv.is_owned = false;
48202         LDKNodeAnnouncement b_conv;
48203         b_conv.inner = untag_ptr(b);
48204         b_conv.is_owned = ptr_is_owned(b);
48205         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48206         b_conv.is_owned = false;
48207         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
48208         return ret_conv;
48209 }
48210
48211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48212         LDKUnsignedChannelAnnouncement this_obj_conv;
48213         this_obj_conv.inner = untag_ptr(this_obj);
48214         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48216         UnsignedChannelAnnouncement_free(this_obj_conv);
48217 }
48218
48219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
48220         LDKUnsignedChannelAnnouncement this_ptr_conv;
48221         this_ptr_conv.inner = untag_ptr(this_ptr);
48222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48224         this_ptr_conv.is_owned = false;
48225         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
48226         int64_t ret_ref = 0;
48227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48229         return ret_ref;
48230 }
48231
48232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48233         LDKUnsignedChannelAnnouncement this_ptr_conv;
48234         this_ptr_conv.inner = untag_ptr(this_ptr);
48235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48237         this_ptr_conv.is_owned = false;
48238         LDKChannelFeatures val_conv;
48239         val_conv.inner = untag_ptr(val);
48240         val_conv.is_owned = ptr_is_owned(val);
48241         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48242         val_conv = ChannelFeatures_clone(&val_conv);
48243         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
48244 }
48245
48246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
48247         LDKUnsignedChannelAnnouncement this_ptr_conv;
48248         this_ptr_conv.inner = untag_ptr(this_ptr);
48249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48251         this_ptr_conv.is_owned = false;
48252         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48253         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
48254         return ret_arr;
48255 }
48256
48257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48258         LDKUnsignedChannelAnnouncement this_ptr_conv;
48259         this_ptr_conv.inner = untag_ptr(this_ptr);
48260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48262         this_ptr_conv.is_owned = false;
48263         LDKThirtyTwoBytes val_ref;
48264         CHECK((*env)->GetArrayLength(env, val) == 32);
48265         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48266         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
48267 }
48268
48269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48270         LDKUnsignedChannelAnnouncement this_ptr_conv;
48271         this_ptr_conv.inner = untag_ptr(this_ptr);
48272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48274         this_ptr_conv.is_owned = false;
48275         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
48276         return ret_conv;
48277 }
48278
48279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48280         LDKUnsignedChannelAnnouncement this_ptr_conv;
48281         this_ptr_conv.inner = untag_ptr(this_ptr);
48282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48284         this_ptr_conv.is_owned = false;
48285         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
48286 }
48287
48288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48289         LDKUnsignedChannelAnnouncement this_ptr_conv;
48290         this_ptr_conv.inner = untag_ptr(this_ptr);
48291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48293         this_ptr_conv.is_owned = false;
48294         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
48295         int64_t ret_ref = 0;
48296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48298         return ret_ref;
48299 }
48300
48301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48302         LDKUnsignedChannelAnnouncement this_ptr_conv;
48303         this_ptr_conv.inner = untag_ptr(this_ptr);
48304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48306         this_ptr_conv.is_owned = false;
48307         LDKNodeId val_conv;
48308         val_conv.inner = untag_ptr(val);
48309         val_conv.is_owned = ptr_is_owned(val);
48310         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48311         val_conv = NodeId_clone(&val_conv);
48312         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
48313 }
48314
48315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48316         LDKUnsignedChannelAnnouncement this_ptr_conv;
48317         this_ptr_conv.inner = untag_ptr(this_ptr);
48318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48320         this_ptr_conv.is_owned = false;
48321         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
48322         int64_t ret_ref = 0;
48323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48325         return ret_ref;
48326 }
48327
48328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48329         LDKUnsignedChannelAnnouncement this_ptr_conv;
48330         this_ptr_conv.inner = untag_ptr(this_ptr);
48331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48333         this_ptr_conv.is_owned = false;
48334         LDKNodeId val_conv;
48335         val_conv.inner = untag_ptr(val);
48336         val_conv.is_owned = ptr_is_owned(val);
48337         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48338         val_conv = NodeId_clone(&val_conv);
48339         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
48340 }
48341
48342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48343         LDKUnsignedChannelAnnouncement this_ptr_conv;
48344         this_ptr_conv.inner = untag_ptr(this_ptr);
48345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48347         this_ptr_conv.is_owned = false;
48348         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
48349         int64_t ret_ref = 0;
48350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48352         return ret_ref;
48353 }
48354
48355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48356         LDKUnsignedChannelAnnouncement this_ptr_conv;
48357         this_ptr_conv.inner = untag_ptr(this_ptr);
48358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48360         this_ptr_conv.is_owned = false;
48361         LDKNodeId val_conv;
48362         val_conv.inner = untag_ptr(val);
48363         val_conv.is_owned = ptr_is_owned(val);
48364         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48365         val_conv = NodeId_clone(&val_conv);
48366         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
48367 }
48368
48369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48370         LDKUnsignedChannelAnnouncement this_ptr_conv;
48371         this_ptr_conv.inner = untag_ptr(this_ptr);
48372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48374         this_ptr_conv.is_owned = false;
48375         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
48376         int64_t ret_ref = 0;
48377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48379         return ret_ref;
48380 }
48381
48382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48383         LDKUnsignedChannelAnnouncement this_ptr_conv;
48384         this_ptr_conv.inner = untag_ptr(this_ptr);
48385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48387         this_ptr_conv.is_owned = false;
48388         LDKNodeId val_conv;
48389         val_conv.inner = untag_ptr(val);
48390         val_conv.is_owned = ptr_is_owned(val);
48391         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48392         val_conv = NodeId_clone(&val_conv);
48393         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
48394 }
48395
48396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
48397         LDKUnsignedChannelAnnouncement this_ptr_conv;
48398         this_ptr_conv.inner = untag_ptr(this_ptr);
48399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48401         this_ptr_conv.is_owned = false;
48402         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
48403         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48404         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48405         CVec_u8Z_free(ret_var);
48406         return ret_arr;
48407 }
48408
48409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48410         LDKUnsignedChannelAnnouncement this_ptr_conv;
48411         this_ptr_conv.inner = untag_ptr(this_ptr);
48412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48414         this_ptr_conv.is_owned = false;
48415         LDKCVec_u8Z val_ref;
48416         val_ref.datalen = (*env)->GetArrayLength(env, val);
48417         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48418         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
48419         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
48420 }
48421
48422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1new(JNIEnv *env, jclass clz, int64_t features_arg, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int64_t node_id_1_arg, int64_t node_id_2_arg, int64_t bitcoin_key_1_arg, int64_t bitcoin_key_2_arg, int8_tArray excess_data_arg) {
48423         LDKChannelFeatures features_arg_conv;
48424         features_arg_conv.inner = untag_ptr(features_arg);
48425         features_arg_conv.is_owned = ptr_is_owned(features_arg);
48426         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
48427         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
48428         LDKThirtyTwoBytes chain_hash_arg_ref;
48429         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
48430         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
48431         LDKNodeId node_id_1_arg_conv;
48432         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
48433         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
48434         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
48435         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
48436         LDKNodeId node_id_2_arg_conv;
48437         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
48438         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
48439         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
48440         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
48441         LDKNodeId bitcoin_key_1_arg_conv;
48442         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
48443         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
48444         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
48445         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
48446         LDKNodeId bitcoin_key_2_arg_conv;
48447         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
48448         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
48449         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
48450         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
48451         LDKCVec_u8Z excess_data_arg_ref;
48452         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
48453         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48454         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
48455         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_new(features_arg_conv, chain_hash_arg_ref, short_channel_id_arg, node_id_1_arg_conv, node_id_2_arg_conv, bitcoin_key_1_arg_conv, bitcoin_key_2_arg_conv, excess_data_arg_ref);
48456         int64_t ret_ref = 0;
48457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48459         return ret_ref;
48460 }
48461
48462 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
48463         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
48464         int64_t ret_ref = 0;
48465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48467         return ret_ref;
48468 }
48469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48470         LDKUnsignedChannelAnnouncement arg_conv;
48471         arg_conv.inner = untag_ptr(arg);
48472         arg_conv.is_owned = ptr_is_owned(arg);
48473         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48474         arg_conv.is_owned = false;
48475         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
48476         return ret_conv;
48477 }
48478
48479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48480         LDKUnsignedChannelAnnouncement orig_conv;
48481         orig_conv.inner = untag_ptr(orig);
48482         orig_conv.is_owned = ptr_is_owned(orig);
48483         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48484         orig_conv.is_owned = false;
48485         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
48486         int64_t ret_ref = 0;
48487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48489         return ret_ref;
48490 }
48491
48492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48493         LDKUnsignedChannelAnnouncement a_conv;
48494         a_conv.inner = untag_ptr(a);
48495         a_conv.is_owned = ptr_is_owned(a);
48496         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48497         a_conv.is_owned = false;
48498         LDKUnsignedChannelAnnouncement b_conv;
48499         b_conv.inner = untag_ptr(b);
48500         b_conv.is_owned = ptr_is_owned(b);
48501         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48502         b_conv.is_owned = false;
48503         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
48504         return ret_conv;
48505 }
48506
48507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48508         LDKChannelAnnouncement this_obj_conv;
48509         this_obj_conv.inner = untag_ptr(this_obj);
48510         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48512         ChannelAnnouncement_free(this_obj_conv);
48513 }
48514
48515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48516         LDKChannelAnnouncement this_ptr_conv;
48517         this_ptr_conv.inner = untag_ptr(this_ptr);
48518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48520         this_ptr_conv.is_owned = false;
48521         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48522         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
48523         return ret_arr;
48524 }
48525
48526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48527         LDKChannelAnnouncement this_ptr_conv;
48528         this_ptr_conv.inner = untag_ptr(this_ptr);
48529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48531         this_ptr_conv.is_owned = false;
48532         LDKECDSASignature val_ref;
48533         CHECK((*env)->GetArrayLength(env, val) == 64);
48534         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48535         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
48536 }
48537
48538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48539         LDKChannelAnnouncement this_ptr_conv;
48540         this_ptr_conv.inner = untag_ptr(this_ptr);
48541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48543         this_ptr_conv.is_owned = false;
48544         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48545         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
48546         return ret_arr;
48547 }
48548
48549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48550         LDKChannelAnnouncement this_ptr_conv;
48551         this_ptr_conv.inner = untag_ptr(this_ptr);
48552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48554         this_ptr_conv.is_owned = false;
48555         LDKECDSASignature val_ref;
48556         CHECK((*env)->GetArrayLength(env, val) == 64);
48557         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48558         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
48559 }
48560
48561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48562         LDKChannelAnnouncement this_ptr_conv;
48563         this_ptr_conv.inner = untag_ptr(this_ptr);
48564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48566         this_ptr_conv.is_owned = false;
48567         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48568         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
48569         return ret_arr;
48570 }
48571
48572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48573         LDKChannelAnnouncement this_ptr_conv;
48574         this_ptr_conv.inner = untag_ptr(this_ptr);
48575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48577         this_ptr_conv.is_owned = false;
48578         LDKECDSASignature val_ref;
48579         CHECK((*env)->GetArrayLength(env, val) == 64);
48580         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48581         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
48582 }
48583
48584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48585         LDKChannelAnnouncement this_ptr_conv;
48586         this_ptr_conv.inner = untag_ptr(this_ptr);
48587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48589         this_ptr_conv.is_owned = false;
48590         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48591         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
48592         return ret_arr;
48593 }
48594
48595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48596         LDKChannelAnnouncement this_ptr_conv;
48597         this_ptr_conv.inner = untag_ptr(this_ptr);
48598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48600         this_ptr_conv.is_owned = false;
48601         LDKECDSASignature val_ref;
48602         CHECK((*env)->GetArrayLength(env, val) == 64);
48603         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48604         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
48605 }
48606
48607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
48608         LDKChannelAnnouncement this_ptr_conv;
48609         this_ptr_conv.inner = untag_ptr(this_ptr);
48610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48612         this_ptr_conv.is_owned = false;
48613         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
48614         int64_t ret_ref = 0;
48615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48617         return ret_ref;
48618 }
48619
48620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48621         LDKChannelAnnouncement this_ptr_conv;
48622         this_ptr_conv.inner = untag_ptr(this_ptr);
48623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48625         this_ptr_conv.is_owned = false;
48626         LDKUnsignedChannelAnnouncement val_conv;
48627         val_conv.inner = untag_ptr(val);
48628         val_conv.is_owned = ptr_is_owned(val);
48629         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48630         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
48631         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
48632 }
48633
48634 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) {
48635         LDKECDSASignature node_signature_1_arg_ref;
48636         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
48637         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
48638         LDKECDSASignature node_signature_2_arg_ref;
48639         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
48640         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
48641         LDKECDSASignature bitcoin_signature_1_arg_ref;
48642         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
48643         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
48644         LDKECDSASignature bitcoin_signature_2_arg_ref;
48645         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
48646         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
48647         LDKUnsignedChannelAnnouncement contents_arg_conv;
48648         contents_arg_conv.inner = untag_ptr(contents_arg);
48649         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48650         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48651         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
48652         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);
48653         int64_t ret_ref = 0;
48654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48656         return ret_ref;
48657 }
48658
48659 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
48660         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
48661         int64_t ret_ref = 0;
48662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48664         return ret_ref;
48665 }
48666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48667         LDKChannelAnnouncement arg_conv;
48668         arg_conv.inner = untag_ptr(arg);
48669         arg_conv.is_owned = ptr_is_owned(arg);
48670         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48671         arg_conv.is_owned = false;
48672         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
48673         return ret_conv;
48674 }
48675
48676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48677         LDKChannelAnnouncement orig_conv;
48678         orig_conv.inner = untag_ptr(orig);
48679         orig_conv.is_owned = ptr_is_owned(orig);
48680         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48681         orig_conv.is_owned = false;
48682         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
48683         int64_t ret_ref = 0;
48684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48686         return ret_ref;
48687 }
48688
48689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48690         LDKChannelAnnouncement a_conv;
48691         a_conv.inner = untag_ptr(a);
48692         a_conv.is_owned = ptr_is_owned(a);
48693         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48694         a_conv.is_owned = false;
48695         LDKChannelAnnouncement b_conv;
48696         b_conv.inner = untag_ptr(b);
48697         b_conv.is_owned = ptr_is_owned(b);
48698         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48699         b_conv.is_owned = false;
48700         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
48701         return ret_conv;
48702 }
48703
48704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48705         LDKUnsignedChannelUpdate this_obj_conv;
48706         this_obj_conv.inner = untag_ptr(this_obj);
48707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48709         UnsignedChannelUpdate_free(this_obj_conv);
48710 }
48711
48712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
48713         LDKUnsignedChannelUpdate this_ptr_conv;
48714         this_ptr_conv.inner = untag_ptr(this_ptr);
48715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48717         this_ptr_conv.is_owned = false;
48718         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48719         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
48720         return ret_arr;
48721 }
48722
48723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48724         LDKUnsignedChannelUpdate this_ptr_conv;
48725         this_ptr_conv.inner = untag_ptr(this_ptr);
48726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48728         this_ptr_conv.is_owned = false;
48729         LDKThirtyTwoBytes val_ref;
48730         CHECK((*env)->GetArrayLength(env, val) == 32);
48731         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48732         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
48733 }
48734
48735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48736         LDKUnsignedChannelUpdate this_ptr_conv;
48737         this_ptr_conv.inner = untag_ptr(this_ptr);
48738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48740         this_ptr_conv.is_owned = false;
48741         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
48742         return ret_conv;
48743 }
48744
48745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48746         LDKUnsignedChannelUpdate this_ptr_conv;
48747         this_ptr_conv.inner = untag_ptr(this_ptr);
48748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48750         this_ptr_conv.is_owned = false;
48751         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
48752 }
48753
48754 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
48755         LDKUnsignedChannelUpdate this_ptr_conv;
48756         this_ptr_conv.inner = untag_ptr(this_ptr);
48757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48759         this_ptr_conv.is_owned = false;
48760         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
48761         return ret_conv;
48762 }
48763
48764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48765         LDKUnsignedChannelUpdate this_ptr_conv;
48766         this_ptr_conv.inner = untag_ptr(this_ptr);
48767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48769         this_ptr_conv.is_owned = false;
48770         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
48771 }
48772
48773 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
48774         LDKUnsignedChannelUpdate this_ptr_conv;
48775         this_ptr_conv.inner = untag_ptr(this_ptr);
48776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48778         this_ptr_conv.is_owned = false;
48779         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
48780         return ret_conv;
48781 }
48782
48783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
48784         LDKUnsignedChannelUpdate this_ptr_conv;
48785         this_ptr_conv.inner = untag_ptr(this_ptr);
48786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48788         this_ptr_conv.is_owned = false;
48789         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
48790 }
48791
48792 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
48793         LDKUnsignedChannelUpdate this_ptr_conv;
48794         this_ptr_conv.inner = untag_ptr(this_ptr);
48795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48797         this_ptr_conv.is_owned = false;
48798         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
48799         return ret_conv;
48800 }
48801
48802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48803         LDKUnsignedChannelUpdate this_ptr_conv;
48804         this_ptr_conv.inner = untag_ptr(this_ptr);
48805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48807         this_ptr_conv.is_owned = false;
48808         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
48809 }
48810
48811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48812         LDKUnsignedChannelUpdate this_ptr_conv;
48813         this_ptr_conv.inner = untag_ptr(this_ptr);
48814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48816         this_ptr_conv.is_owned = false;
48817         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
48818         return ret_conv;
48819 }
48820
48821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48822         LDKUnsignedChannelUpdate this_ptr_conv;
48823         this_ptr_conv.inner = untag_ptr(this_ptr);
48824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48826         this_ptr_conv.is_owned = false;
48827         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
48828 }
48829
48830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48831         LDKUnsignedChannelUpdate this_ptr_conv;
48832         this_ptr_conv.inner = untag_ptr(this_ptr);
48833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48835         this_ptr_conv.is_owned = false;
48836         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
48837         return ret_conv;
48838 }
48839
48840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48841         LDKUnsignedChannelUpdate this_ptr_conv;
48842         this_ptr_conv.inner = untag_ptr(this_ptr);
48843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48845         this_ptr_conv.is_owned = false;
48846         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
48847 }
48848
48849 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48850         LDKUnsignedChannelUpdate this_ptr_conv;
48851         this_ptr_conv.inner = untag_ptr(this_ptr);
48852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48854         this_ptr_conv.is_owned = false;
48855         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
48856         return ret_conv;
48857 }
48858
48859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48860         LDKUnsignedChannelUpdate this_ptr_conv;
48861         this_ptr_conv.inner = untag_ptr(this_ptr);
48862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48864         this_ptr_conv.is_owned = false;
48865         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
48866 }
48867
48868 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
48869         LDKUnsignedChannelUpdate this_ptr_conv;
48870         this_ptr_conv.inner = untag_ptr(this_ptr);
48871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48873         this_ptr_conv.is_owned = false;
48874         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
48875         return ret_conv;
48876 }
48877
48878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48879         LDKUnsignedChannelUpdate this_ptr_conv;
48880         this_ptr_conv.inner = untag_ptr(this_ptr);
48881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48883         this_ptr_conv.is_owned = false;
48884         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
48885 }
48886
48887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
48888         LDKUnsignedChannelUpdate this_ptr_conv;
48889         this_ptr_conv.inner = untag_ptr(this_ptr);
48890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48892         this_ptr_conv.is_owned = false;
48893         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
48894         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48895         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48896         CVec_u8Z_free(ret_var);
48897         return ret_arr;
48898 }
48899
48900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48901         LDKUnsignedChannelUpdate this_ptr_conv;
48902         this_ptr_conv.inner = untag_ptr(this_ptr);
48903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48905         this_ptr_conv.is_owned = false;
48906         LDKCVec_u8Z val_ref;
48907         val_ref.datalen = (*env)->GetArrayLength(env, val);
48908         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48909         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
48910         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
48911 }
48912
48913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int32_t timestamp_arg, int8_t flags_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int8_tArray excess_data_arg) {
48914         LDKThirtyTwoBytes chain_hash_arg_ref;
48915         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
48916         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
48917         LDKCVec_u8Z excess_data_arg_ref;
48918         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
48919         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48920         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
48921         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_new(chain_hash_arg_ref, short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg_ref);
48922         int64_t ret_ref = 0;
48923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48925         return ret_ref;
48926 }
48927
48928 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
48929         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
48930         int64_t ret_ref = 0;
48931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48933         return ret_ref;
48934 }
48935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48936         LDKUnsignedChannelUpdate arg_conv;
48937         arg_conv.inner = untag_ptr(arg);
48938         arg_conv.is_owned = ptr_is_owned(arg);
48939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48940         arg_conv.is_owned = false;
48941         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
48942         return ret_conv;
48943 }
48944
48945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48946         LDKUnsignedChannelUpdate orig_conv;
48947         orig_conv.inner = untag_ptr(orig);
48948         orig_conv.is_owned = ptr_is_owned(orig);
48949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48950         orig_conv.is_owned = false;
48951         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
48952         int64_t ret_ref = 0;
48953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48955         return ret_ref;
48956 }
48957
48958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48959         LDKUnsignedChannelUpdate a_conv;
48960         a_conv.inner = untag_ptr(a);
48961         a_conv.is_owned = ptr_is_owned(a);
48962         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48963         a_conv.is_owned = false;
48964         LDKUnsignedChannelUpdate b_conv;
48965         b_conv.inner = untag_ptr(b);
48966         b_conv.is_owned = ptr_is_owned(b);
48967         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48968         b_conv.is_owned = false;
48969         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
48970         return ret_conv;
48971 }
48972
48973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48974         LDKChannelUpdate this_obj_conv;
48975         this_obj_conv.inner = untag_ptr(this_obj);
48976         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48978         ChannelUpdate_free(this_obj_conv);
48979 }
48980
48981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48982         LDKChannelUpdate this_ptr_conv;
48983         this_ptr_conv.inner = untag_ptr(this_ptr);
48984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48986         this_ptr_conv.is_owned = false;
48987         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48988         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
48989         return ret_arr;
48990 }
48991
48992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48993         LDKChannelUpdate this_ptr_conv;
48994         this_ptr_conv.inner = untag_ptr(this_ptr);
48995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48997         this_ptr_conv.is_owned = false;
48998         LDKECDSASignature val_ref;
48999         CHECK((*env)->GetArrayLength(env, val) == 64);
49000         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49001         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
49002 }
49003
49004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
49005         LDKChannelUpdate this_ptr_conv;
49006         this_ptr_conv.inner = untag_ptr(this_ptr);
49007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49009         this_ptr_conv.is_owned = false;
49010         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
49011         int64_t ret_ref = 0;
49012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49014         return ret_ref;
49015 }
49016
49017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49018         LDKChannelUpdate this_ptr_conv;
49019         this_ptr_conv.inner = untag_ptr(this_ptr);
49020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49022         this_ptr_conv.is_owned = false;
49023         LDKUnsignedChannelUpdate val_conv;
49024         val_conv.inner = untag_ptr(val);
49025         val_conv.is_owned = ptr_is_owned(val);
49026         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49027         val_conv = UnsignedChannelUpdate_clone(&val_conv);
49028         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
49029 }
49030
49031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
49032         LDKECDSASignature signature_arg_ref;
49033         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
49034         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
49035         LDKUnsignedChannelUpdate contents_arg_conv;
49036         contents_arg_conv.inner = untag_ptr(contents_arg);
49037         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49038         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49039         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
49040         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
49041         int64_t ret_ref = 0;
49042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49044         return ret_ref;
49045 }
49046
49047 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
49048         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
49049         int64_t ret_ref = 0;
49050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49052         return ret_ref;
49053 }
49054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49055         LDKChannelUpdate arg_conv;
49056         arg_conv.inner = untag_ptr(arg);
49057         arg_conv.is_owned = ptr_is_owned(arg);
49058         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49059         arg_conv.is_owned = false;
49060         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
49061         return ret_conv;
49062 }
49063
49064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49065         LDKChannelUpdate orig_conv;
49066         orig_conv.inner = untag_ptr(orig);
49067         orig_conv.is_owned = ptr_is_owned(orig);
49068         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49069         orig_conv.is_owned = false;
49070         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
49071         int64_t ret_ref = 0;
49072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49074         return ret_ref;
49075 }
49076
49077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49078         LDKChannelUpdate a_conv;
49079         a_conv.inner = untag_ptr(a);
49080         a_conv.is_owned = ptr_is_owned(a);
49081         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49082         a_conv.is_owned = false;
49083         LDKChannelUpdate b_conv;
49084         b_conv.inner = untag_ptr(b);
49085         b_conv.is_owned = ptr_is_owned(b);
49086         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49087         b_conv.is_owned = false;
49088         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
49089         return ret_conv;
49090 }
49091
49092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49093         LDKQueryChannelRange this_obj_conv;
49094         this_obj_conv.inner = untag_ptr(this_obj);
49095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49097         QueryChannelRange_free(this_obj_conv);
49098 }
49099
49100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49101         LDKQueryChannelRange this_ptr_conv;
49102         this_ptr_conv.inner = untag_ptr(this_ptr);
49103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49105         this_ptr_conv.is_owned = false;
49106         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49107         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
49108         return ret_arr;
49109 }
49110
49111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49112         LDKQueryChannelRange this_ptr_conv;
49113         this_ptr_conv.inner = untag_ptr(this_ptr);
49114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49116         this_ptr_conv.is_owned = false;
49117         LDKThirtyTwoBytes val_ref;
49118         CHECK((*env)->GetArrayLength(env, val) == 32);
49119         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49120         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49121 }
49122
49123 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
49124         LDKQueryChannelRange this_ptr_conv;
49125         this_ptr_conv.inner = untag_ptr(this_ptr);
49126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49128         this_ptr_conv.is_owned = false;
49129         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
49130         return ret_conv;
49131 }
49132
49133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49134         LDKQueryChannelRange this_ptr_conv;
49135         this_ptr_conv.inner = untag_ptr(this_ptr);
49136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49138         this_ptr_conv.is_owned = false;
49139         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
49140 }
49141
49142 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
49143         LDKQueryChannelRange this_ptr_conv;
49144         this_ptr_conv.inner = untag_ptr(this_ptr);
49145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49147         this_ptr_conv.is_owned = false;
49148         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
49149         return ret_conv;
49150 }
49151
49152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49153         LDKQueryChannelRange this_ptr_conv;
49154         this_ptr_conv.inner = untag_ptr(this_ptr);
49155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49157         this_ptr_conv.is_owned = false;
49158         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49159 }
49160
49161 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) {
49162         LDKThirtyTwoBytes chain_hash_arg_ref;
49163         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49164         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49165         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
49166         int64_t ret_ref = 0;
49167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49169         return ret_ref;
49170 }
49171
49172 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
49173         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
49174         int64_t ret_ref = 0;
49175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49177         return ret_ref;
49178 }
49179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49180         LDKQueryChannelRange arg_conv;
49181         arg_conv.inner = untag_ptr(arg);
49182         arg_conv.is_owned = ptr_is_owned(arg);
49183         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49184         arg_conv.is_owned = false;
49185         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
49186         return ret_conv;
49187 }
49188
49189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49190         LDKQueryChannelRange orig_conv;
49191         orig_conv.inner = untag_ptr(orig);
49192         orig_conv.is_owned = ptr_is_owned(orig);
49193         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49194         orig_conv.is_owned = false;
49195         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
49196         int64_t ret_ref = 0;
49197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49199         return ret_ref;
49200 }
49201
49202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49203         LDKQueryChannelRange a_conv;
49204         a_conv.inner = untag_ptr(a);
49205         a_conv.is_owned = ptr_is_owned(a);
49206         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49207         a_conv.is_owned = false;
49208         LDKQueryChannelRange b_conv;
49209         b_conv.inner = untag_ptr(b);
49210         b_conv.is_owned = ptr_is_owned(b);
49211         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49212         b_conv.is_owned = false;
49213         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
49214         return ret_conv;
49215 }
49216
49217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49218         LDKReplyChannelRange this_obj_conv;
49219         this_obj_conv.inner = untag_ptr(this_obj);
49220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49222         ReplyChannelRange_free(this_obj_conv);
49223 }
49224
49225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49226         LDKReplyChannelRange this_ptr_conv;
49227         this_ptr_conv.inner = untag_ptr(this_ptr);
49228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49230         this_ptr_conv.is_owned = false;
49231         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49232         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
49233         return ret_arr;
49234 }
49235
49236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49237         LDKReplyChannelRange this_ptr_conv;
49238         this_ptr_conv.inner = untag_ptr(this_ptr);
49239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49241         this_ptr_conv.is_owned = false;
49242         LDKThirtyTwoBytes val_ref;
49243         CHECK((*env)->GetArrayLength(env, val) == 32);
49244         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49245         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49246 }
49247
49248 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
49249         LDKReplyChannelRange this_ptr_conv;
49250         this_ptr_conv.inner = untag_ptr(this_ptr);
49251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49253         this_ptr_conv.is_owned = false;
49254         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
49255         return ret_conv;
49256 }
49257
49258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49259         LDKReplyChannelRange this_ptr_conv;
49260         this_ptr_conv.inner = untag_ptr(this_ptr);
49261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49263         this_ptr_conv.is_owned = false;
49264         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
49265 }
49266
49267 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
49268         LDKReplyChannelRange this_ptr_conv;
49269         this_ptr_conv.inner = untag_ptr(this_ptr);
49270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49272         this_ptr_conv.is_owned = false;
49273         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
49274         return ret_conv;
49275 }
49276
49277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49278         LDKReplyChannelRange this_ptr_conv;
49279         this_ptr_conv.inner = untag_ptr(this_ptr);
49280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49282         this_ptr_conv.is_owned = false;
49283         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49284 }
49285
49286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
49287         LDKReplyChannelRange this_ptr_conv;
49288         this_ptr_conv.inner = untag_ptr(this_ptr);
49289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49291         this_ptr_conv.is_owned = false;
49292         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
49293         return ret_conv;
49294 }
49295
49296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
49297         LDKReplyChannelRange this_ptr_conv;
49298         this_ptr_conv.inner = untag_ptr(this_ptr);
49299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49301         this_ptr_conv.is_owned = false;
49302         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
49303 }
49304
49305 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
49306         LDKReplyChannelRange this_ptr_conv;
49307         this_ptr_conv.inner = untag_ptr(this_ptr);
49308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49310         this_ptr_conv.is_owned = false;
49311         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
49312         int64_tArray ret_arr = NULL;
49313         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49314         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49315         for (size_t g = 0; g < ret_var.datalen; g++) {
49316                 int64_t ret_conv_6_conv = ret_var.data[g];
49317                 ret_arr_ptr[g] = ret_conv_6_conv;
49318         }
49319         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49320         FREE(ret_var.data);
49321         return ret_arr;
49322 }
49323
49324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
49325         LDKReplyChannelRange this_ptr_conv;
49326         this_ptr_conv.inner = untag_ptr(this_ptr);
49327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49329         this_ptr_conv.is_owned = false;
49330         LDKCVec_u64Z val_constr;
49331         val_constr.datalen = (*env)->GetArrayLength(env, val);
49332         if (val_constr.datalen > 0)
49333                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49334         else
49335                 val_constr.data = NULL;
49336         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
49337         for (size_t g = 0; g < val_constr.datalen; g++) {
49338                 int64_t val_conv_6 = val_vals[g];
49339                 val_constr.data[g] = val_conv_6;
49340         }
49341         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
49342         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
49343 }
49344
49345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean sync_complete_arg, int64_tArray short_channel_ids_arg) {
49346         LDKThirtyTwoBytes chain_hash_arg_ref;
49347         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49348         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49349         LDKCVec_u64Z short_channel_ids_arg_constr;
49350         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
49351         if (short_channel_ids_arg_constr.datalen > 0)
49352                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49353         else
49354                 short_channel_ids_arg_constr.data = NULL;
49355         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
49356         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49357                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
49358                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
49359         }
49360         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
49361         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
49362         int64_t ret_ref = 0;
49363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49365         return ret_ref;
49366 }
49367
49368 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
49369         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
49370         int64_t ret_ref = 0;
49371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49373         return ret_ref;
49374 }
49375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49376         LDKReplyChannelRange arg_conv;
49377         arg_conv.inner = untag_ptr(arg);
49378         arg_conv.is_owned = ptr_is_owned(arg);
49379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49380         arg_conv.is_owned = false;
49381         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
49382         return ret_conv;
49383 }
49384
49385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49386         LDKReplyChannelRange orig_conv;
49387         orig_conv.inner = untag_ptr(orig);
49388         orig_conv.is_owned = ptr_is_owned(orig);
49389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49390         orig_conv.is_owned = false;
49391         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
49392         int64_t ret_ref = 0;
49393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49395         return ret_ref;
49396 }
49397
49398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49399         LDKReplyChannelRange a_conv;
49400         a_conv.inner = untag_ptr(a);
49401         a_conv.is_owned = ptr_is_owned(a);
49402         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49403         a_conv.is_owned = false;
49404         LDKReplyChannelRange b_conv;
49405         b_conv.inner = untag_ptr(b);
49406         b_conv.is_owned = ptr_is_owned(b);
49407         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49408         b_conv.is_owned = false;
49409         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
49410         return ret_conv;
49411 }
49412
49413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49414         LDKQueryShortChannelIds this_obj_conv;
49415         this_obj_conv.inner = untag_ptr(this_obj);
49416         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49418         QueryShortChannelIds_free(this_obj_conv);
49419 }
49420
49421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49422         LDKQueryShortChannelIds this_ptr_conv;
49423         this_ptr_conv.inner = untag_ptr(this_ptr);
49424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49426         this_ptr_conv.is_owned = false;
49427         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49428         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
49429         return ret_arr;
49430 }
49431
49432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49433         LDKQueryShortChannelIds this_ptr_conv;
49434         this_ptr_conv.inner = untag_ptr(this_ptr);
49435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49437         this_ptr_conv.is_owned = false;
49438         LDKThirtyTwoBytes val_ref;
49439         CHECK((*env)->GetArrayLength(env, val) == 32);
49440         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49441         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
49442 }
49443
49444 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
49445         LDKQueryShortChannelIds this_ptr_conv;
49446         this_ptr_conv.inner = untag_ptr(this_ptr);
49447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49449         this_ptr_conv.is_owned = false;
49450         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
49451         int64_tArray ret_arr = NULL;
49452         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49453         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49454         for (size_t g = 0; g < ret_var.datalen; g++) {
49455                 int64_t ret_conv_6_conv = ret_var.data[g];
49456                 ret_arr_ptr[g] = ret_conv_6_conv;
49457         }
49458         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49459         FREE(ret_var.data);
49460         return ret_arr;
49461 }
49462
49463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
49464         LDKQueryShortChannelIds this_ptr_conv;
49465         this_ptr_conv.inner = untag_ptr(this_ptr);
49466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49468         this_ptr_conv.is_owned = false;
49469         LDKCVec_u64Z val_constr;
49470         val_constr.datalen = (*env)->GetArrayLength(env, val);
49471         if (val_constr.datalen > 0)
49472                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49473         else
49474                 val_constr.data = NULL;
49475         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
49476         for (size_t g = 0; g < val_constr.datalen; g++) {
49477                 int64_t val_conv_6 = val_vals[g];
49478                 val_constr.data[g] = val_conv_6;
49479         }
49480         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
49481         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
49482 }
49483
49484 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) {
49485         LDKThirtyTwoBytes chain_hash_arg_ref;
49486         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49487         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49488         LDKCVec_u64Z short_channel_ids_arg_constr;
49489         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
49490         if (short_channel_ids_arg_constr.datalen > 0)
49491                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49492         else
49493                 short_channel_ids_arg_constr.data = NULL;
49494         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
49495         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49496                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
49497                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
49498         }
49499         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
49500         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
49501         int64_t ret_ref = 0;
49502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49504         return ret_ref;
49505 }
49506
49507 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
49508         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
49509         int64_t ret_ref = 0;
49510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49512         return ret_ref;
49513 }
49514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49515         LDKQueryShortChannelIds arg_conv;
49516         arg_conv.inner = untag_ptr(arg);
49517         arg_conv.is_owned = ptr_is_owned(arg);
49518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49519         arg_conv.is_owned = false;
49520         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
49521         return ret_conv;
49522 }
49523
49524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49525         LDKQueryShortChannelIds orig_conv;
49526         orig_conv.inner = untag_ptr(orig);
49527         orig_conv.is_owned = ptr_is_owned(orig);
49528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49529         orig_conv.is_owned = false;
49530         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
49531         int64_t ret_ref = 0;
49532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49534         return ret_ref;
49535 }
49536
49537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49538         LDKQueryShortChannelIds a_conv;
49539         a_conv.inner = untag_ptr(a);
49540         a_conv.is_owned = ptr_is_owned(a);
49541         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49542         a_conv.is_owned = false;
49543         LDKQueryShortChannelIds b_conv;
49544         b_conv.inner = untag_ptr(b);
49545         b_conv.is_owned = ptr_is_owned(b);
49546         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49547         b_conv.is_owned = false;
49548         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
49549         return ret_conv;
49550 }
49551
49552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49553         LDKReplyShortChannelIdsEnd this_obj_conv;
49554         this_obj_conv.inner = untag_ptr(this_obj);
49555         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49557         ReplyShortChannelIdsEnd_free(this_obj_conv);
49558 }
49559
49560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49561         LDKReplyShortChannelIdsEnd this_ptr_conv;
49562         this_ptr_conv.inner = untag_ptr(this_ptr);
49563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49565         this_ptr_conv.is_owned = false;
49566         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49567         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
49568         return ret_arr;
49569 }
49570
49571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49572         LDKReplyShortChannelIdsEnd this_ptr_conv;
49573         this_ptr_conv.inner = untag_ptr(this_ptr);
49574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49576         this_ptr_conv.is_owned = false;
49577         LDKThirtyTwoBytes val_ref;
49578         CHECK((*env)->GetArrayLength(env, val) == 32);
49579         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49580         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
49581 }
49582
49583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
49584         LDKReplyShortChannelIdsEnd this_ptr_conv;
49585         this_ptr_conv.inner = untag_ptr(this_ptr);
49586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49588         this_ptr_conv.is_owned = false;
49589         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
49590         return ret_conv;
49591 }
49592
49593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
49594         LDKReplyShortChannelIdsEnd this_ptr_conv;
49595         this_ptr_conv.inner = untag_ptr(this_ptr);
49596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49598         this_ptr_conv.is_owned = false;
49599         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
49600 }
49601
49602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
49603         LDKThirtyTwoBytes chain_hash_arg_ref;
49604         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49605         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49606         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
49607         int64_t ret_ref = 0;
49608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49610         return ret_ref;
49611 }
49612
49613 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
49614         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
49615         int64_t ret_ref = 0;
49616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49618         return ret_ref;
49619 }
49620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49621         LDKReplyShortChannelIdsEnd arg_conv;
49622         arg_conv.inner = untag_ptr(arg);
49623         arg_conv.is_owned = ptr_is_owned(arg);
49624         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49625         arg_conv.is_owned = false;
49626         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
49627         return ret_conv;
49628 }
49629
49630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49631         LDKReplyShortChannelIdsEnd orig_conv;
49632         orig_conv.inner = untag_ptr(orig);
49633         orig_conv.is_owned = ptr_is_owned(orig);
49634         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49635         orig_conv.is_owned = false;
49636         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
49637         int64_t ret_ref = 0;
49638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49640         return ret_ref;
49641 }
49642
49643 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49644         LDKReplyShortChannelIdsEnd a_conv;
49645         a_conv.inner = untag_ptr(a);
49646         a_conv.is_owned = ptr_is_owned(a);
49647         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49648         a_conv.is_owned = false;
49649         LDKReplyShortChannelIdsEnd b_conv;
49650         b_conv.inner = untag_ptr(b);
49651         b_conv.is_owned = ptr_is_owned(b);
49652         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49653         b_conv.is_owned = false;
49654         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
49655         return ret_conv;
49656 }
49657
49658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49659         LDKGossipTimestampFilter this_obj_conv;
49660         this_obj_conv.inner = untag_ptr(this_obj);
49661         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49663         GossipTimestampFilter_free(this_obj_conv);
49664 }
49665
49666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49667         LDKGossipTimestampFilter this_ptr_conv;
49668         this_ptr_conv.inner = untag_ptr(this_ptr);
49669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49671         this_ptr_conv.is_owned = false;
49672         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49673         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
49674         return ret_arr;
49675 }
49676
49677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49678         LDKGossipTimestampFilter this_ptr_conv;
49679         this_ptr_conv.inner = untag_ptr(this_ptr);
49680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49682         this_ptr_conv.is_owned = false;
49683         LDKThirtyTwoBytes val_ref;
49684         CHECK((*env)->GetArrayLength(env, val) == 32);
49685         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49686         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
49687 }
49688
49689 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
49690         LDKGossipTimestampFilter this_ptr_conv;
49691         this_ptr_conv.inner = untag_ptr(this_ptr);
49692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49694         this_ptr_conv.is_owned = false;
49695         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
49696         return ret_conv;
49697 }
49698
49699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49700         LDKGossipTimestampFilter this_ptr_conv;
49701         this_ptr_conv.inner = untag_ptr(this_ptr);
49702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49704         this_ptr_conv.is_owned = false;
49705         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
49706 }
49707
49708 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
49709         LDKGossipTimestampFilter this_ptr_conv;
49710         this_ptr_conv.inner = untag_ptr(this_ptr);
49711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49713         this_ptr_conv.is_owned = false;
49714         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
49715         return ret_conv;
49716 }
49717
49718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49719         LDKGossipTimestampFilter this_ptr_conv;
49720         this_ptr_conv.inner = untag_ptr(this_ptr);
49721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49723         this_ptr_conv.is_owned = false;
49724         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
49725 }
49726
49727 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) {
49728         LDKThirtyTwoBytes chain_hash_arg_ref;
49729         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49730         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49731         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
49732         int64_t ret_ref = 0;
49733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49735         return ret_ref;
49736 }
49737
49738 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
49739         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
49740         int64_t ret_ref = 0;
49741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49743         return ret_ref;
49744 }
49745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49746         LDKGossipTimestampFilter arg_conv;
49747         arg_conv.inner = untag_ptr(arg);
49748         arg_conv.is_owned = ptr_is_owned(arg);
49749         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49750         arg_conv.is_owned = false;
49751         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
49752         return ret_conv;
49753 }
49754
49755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49756         LDKGossipTimestampFilter orig_conv;
49757         orig_conv.inner = untag_ptr(orig);
49758         orig_conv.is_owned = ptr_is_owned(orig);
49759         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49760         orig_conv.is_owned = false;
49761         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
49762         int64_t ret_ref = 0;
49763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49765         return ret_ref;
49766 }
49767
49768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49769         LDKGossipTimestampFilter a_conv;
49770         a_conv.inner = untag_ptr(a);
49771         a_conv.is_owned = ptr_is_owned(a);
49772         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49773         a_conv.is_owned = false;
49774         LDKGossipTimestampFilter b_conv;
49775         b_conv.inner = untag_ptr(b);
49776         b_conv.is_owned = ptr_is_owned(b);
49777         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49778         b_conv.is_owned = false;
49779         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
49780         return ret_conv;
49781 }
49782
49783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49784         if (!ptr_is_owned(this_ptr)) return;
49785         void* this_ptr_ptr = untag_ptr(this_ptr);
49786         CHECK_ACCESS(this_ptr_ptr);
49787         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
49788         FREE(untag_ptr(this_ptr));
49789         ErrorAction_free(this_ptr_conv);
49790 }
49791
49792 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
49793         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49794         *ret_copy = ErrorAction_clone(arg);
49795         int64_t ret_ref = tag_ptr(ret_copy, true);
49796         return ret_ref;
49797 }
49798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49799         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
49800         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
49801         return ret_conv;
49802 }
49803
49804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49805         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
49806         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49807         *ret_copy = ErrorAction_clone(orig_conv);
49808         int64_t ret_ref = tag_ptr(ret_copy, true);
49809         return ret_ref;
49810 }
49811
49812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
49813         LDKErrorMessage msg_conv;
49814         msg_conv.inner = untag_ptr(msg);
49815         msg_conv.is_owned = ptr_is_owned(msg);
49816         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49817         msg_conv = ErrorMessage_clone(&msg_conv);
49818         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49819         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
49820         int64_t ret_ref = tag_ptr(ret_copy, true);
49821         return ret_ref;
49822 }
49823
49824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
49825         LDKWarningMessage msg_conv;
49826         msg_conv.inner = untag_ptr(msg);
49827         msg_conv.is_owned = ptr_is_owned(msg);
49828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49829         msg_conv = WarningMessage_clone(&msg_conv);
49830         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49831         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
49832         int64_t ret_ref = tag_ptr(ret_copy, true);
49833         return ret_ref;
49834 }
49835
49836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
49837         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49838         *ret_copy = ErrorAction_ignore_error();
49839         int64_t ret_ref = tag_ptr(ret_copy, true);
49840         return ret_ref;
49841 }
49842
49843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
49844         LDKLevel a_conv = LDKLevel_from_java(env, a);
49845         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49846         *ret_copy = ErrorAction_ignore_and_log(a_conv);
49847         int64_t ret_ref = tag_ptr(ret_copy, true);
49848         return ret_ref;
49849 }
49850
49851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
49852         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49853         *ret_copy = ErrorAction_ignore_duplicate_gossip();
49854         int64_t ret_ref = tag_ptr(ret_copy, true);
49855         return ret_ref;
49856 }
49857
49858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
49859         LDKErrorMessage msg_conv;
49860         msg_conv.inner = untag_ptr(msg);
49861         msg_conv.is_owned = ptr_is_owned(msg);
49862         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49863         msg_conv = ErrorMessage_clone(&msg_conv);
49864         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49865         *ret_copy = ErrorAction_send_error_message(msg_conv);
49866         int64_t ret_ref = tag_ptr(ret_copy, true);
49867         return ret_ref;
49868 }
49869
49870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
49871         LDKWarningMessage msg_conv;
49872         msg_conv.inner = untag_ptr(msg);
49873         msg_conv.is_owned = ptr_is_owned(msg);
49874         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49875         msg_conv = WarningMessage_clone(&msg_conv);
49876         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
49877         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49878         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
49879         int64_t ret_ref = tag_ptr(ret_copy, true);
49880         return ret_ref;
49881 }
49882
49883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49884         LDKLightningError this_obj_conv;
49885         this_obj_conv.inner = untag_ptr(this_obj);
49886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49888         LightningError_free(this_obj_conv);
49889 }
49890
49891 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
49892         LDKLightningError this_ptr_conv;
49893         this_ptr_conv.inner = untag_ptr(this_ptr);
49894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49896         this_ptr_conv.is_owned = false;
49897         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
49898         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49899         Str_free(ret_str);
49900         return ret_conv;
49901 }
49902
49903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
49904         LDKLightningError this_ptr_conv;
49905         this_ptr_conv.inner = untag_ptr(this_ptr);
49906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49908         this_ptr_conv.is_owned = false;
49909         LDKStr val_conv = java_to_owned_str(env, val);
49910         LightningError_set_err(&this_ptr_conv, val_conv);
49911 }
49912
49913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
49914         LDKLightningError this_ptr_conv;
49915         this_ptr_conv.inner = untag_ptr(this_ptr);
49916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49918         this_ptr_conv.is_owned = false;
49919         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
49920         *ret_copy = LightningError_get_action(&this_ptr_conv);
49921         int64_t ret_ref = tag_ptr(ret_copy, true);
49922         return ret_ref;
49923 }
49924
49925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49926         LDKLightningError this_ptr_conv;
49927         this_ptr_conv.inner = untag_ptr(this_ptr);
49928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49930         this_ptr_conv.is_owned = false;
49931         void* val_ptr = untag_ptr(val);
49932         CHECK_ACCESS(val_ptr);
49933         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
49934         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
49935         LightningError_set_action(&this_ptr_conv, val_conv);
49936 }
49937
49938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
49939         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
49940         void* action_arg_ptr = untag_ptr(action_arg);
49941         CHECK_ACCESS(action_arg_ptr);
49942         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
49943         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
49944         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
49945         int64_t ret_ref = 0;
49946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49948         return ret_ref;
49949 }
49950
49951 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
49952         LDKLightningError ret_var = LightningError_clone(arg);
49953         int64_t ret_ref = 0;
49954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49956         return ret_ref;
49957 }
49958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49959         LDKLightningError arg_conv;
49960         arg_conv.inner = untag_ptr(arg);
49961         arg_conv.is_owned = ptr_is_owned(arg);
49962         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49963         arg_conv.is_owned = false;
49964         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
49965         return ret_conv;
49966 }
49967
49968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49969         LDKLightningError orig_conv;
49970         orig_conv.inner = untag_ptr(orig);
49971         orig_conv.is_owned = ptr_is_owned(orig);
49972         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49973         orig_conv.is_owned = false;
49974         LDKLightningError ret_var = LightningError_clone(&orig_conv);
49975         int64_t ret_ref = 0;
49976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49978         return ret_ref;
49979 }
49980
49981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49982         LDKCommitmentUpdate this_obj_conv;
49983         this_obj_conv.inner = untag_ptr(this_obj);
49984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49986         CommitmentUpdate_free(this_obj_conv);
49987 }
49988
49989 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
49990         LDKCommitmentUpdate this_ptr_conv;
49991         this_ptr_conv.inner = untag_ptr(this_ptr);
49992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49994         this_ptr_conv.is_owned = false;
49995         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
49996         int64_tArray ret_arr = NULL;
49997         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49998         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49999         for (size_t p = 0; p < ret_var.datalen; p++) {
50000                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
50001                 int64_t ret_conv_15_ref = 0;
50002                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
50003                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
50004                 ret_arr_ptr[p] = ret_conv_15_ref;
50005         }
50006         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50007         FREE(ret_var.data);
50008         return ret_arr;
50009 }
50010
50011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50012         LDKCommitmentUpdate this_ptr_conv;
50013         this_ptr_conv.inner = untag_ptr(this_ptr);
50014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50016         this_ptr_conv.is_owned = false;
50017         LDKCVec_UpdateAddHTLCZ val_constr;
50018         val_constr.datalen = (*env)->GetArrayLength(env, val);
50019         if (val_constr.datalen > 0)
50020                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50021         else
50022                 val_constr.data = NULL;
50023         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50024         for (size_t p = 0; p < val_constr.datalen; p++) {
50025                 int64_t val_conv_15 = val_vals[p];
50026                 LDKUpdateAddHTLC val_conv_15_conv;
50027                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
50028                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
50029                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
50030                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
50031                 val_constr.data[p] = val_conv_15_conv;
50032         }
50033         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50034         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
50035 }
50036
50037 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50038         LDKCommitmentUpdate this_ptr_conv;
50039         this_ptr_conv.inner = untag_ptr(this_ptr);
50040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50042         this_ptr_conv.is_owned = false;
50043         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
50044         int64_tArray ret_arr = NULL;
50045         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50046         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50047         for (size_t t = 0; t < ret_var.datalen; t++) {
50048                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
50049                 int64_t ret_conv_19_ref = 0;
50050                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
50051                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
50052                 ret_arr_ptr[t] = ret_conv_19_ref;
50053         }
50054         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50055         FREE(ret_var.data);
50056         return ret_arr;
50057 }
50058
50059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50060         LDKCommitmentUpdate this_ptr_conv;
50061         this_ptr_conv.inner = untag_ptr(this_ptr);
50062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50064         this_ptr_conv.is_owned = false;
50065         LDKCVec_UpdateFulfillHTLCZ val_constr;
50066         val_constr.datalen = (*env)->GetArrayLength(env, val);
50067         if (val_constr.datalen > 0)
50068                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50069         else
50070                 val_constr.data = NULL;
50071         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50072         for (size_t t = 0; t < val_constr.datalen; t++) {
50073                 int64_t val_conv_19 = val_vals[t];
50074                 LDKUpdateFulfillHTLC val_conv_19_conv;
50075                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
50076                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
50077                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
50078                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
50079                 val_constr.data[t] = val_conv_19_conv;
50080         }
50081         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50082         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
50083 }
50084
50085 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50086         LDKCommitmentUpdate this_ptr_conv;
50087         this_ptr_conv.inner = untag_ptr(this_ptr);
50088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50090         this_ptr_conv.is_owned = false;
50091         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
50092         int64_tArray ret_arr = NULL;
50093         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50094         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50095         for (size_t q = 0; q < ret_var.datalen; q++) {
50096                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
50097                 int64_t ret_conv_16_ref = 0;
50098                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
50099                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
50100                 ret_arr_ptr[q] = ret_conv_16_ref;
50101         }
50102         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50103         FREE(ret_var.data);
50104         return ret_arr;
50105 }
50106
50107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50108         LDKCommitmentUpdate this_ptr_conv;
50109         this_ptr_conv.inner = untag_ptr(this_ptr);
50110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50112         this_ptr_conv.is_owned = false;
50113         LDKCVec_UpdateFailHTLCZ val_constr;
50114         val_constr.datalen = (*env)->GetArrayLength(env, val);
50115         if (val_constr.datalen > 0)
50116                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50117         else
50118                 val_constr.data = NULL;
50119         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50120         for (size_t q = 0; q < val_constr.datalen; q++) {
50121                 int64_t val_conv_16 = val_vals[q];
50122                 LDKUpdateFailHTLC val_conv_16_conv;
50123                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
50124                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
50125                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
50126                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
50127                 val_constr.data[q] = val_conv_16_conv;
50128         }
50129         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50130         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
50131 }
50132
50133 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50134         LDKCommitmentUpdate this_ptr_conv;
50135         this_ptr_conv.inner = untag_ptr(this_ptr);
50136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50138         this_ptr_conv.is_owned = false;
50139         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
50140         int64_tArray ret_arr = NULL;
50141         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50142         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50143         for (size_t z = 0; z < ret_var.datalen; z++) {
50144                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
50145                 int64_t ret_conv_25_ref = 0;
50146                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
50147                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
50148                 ret_arr_ptr[z] = ret_conv_25_ref;
50149         }
50150         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50151         FREE(ret_var.data);
50152         return ret_arr;
50153 }
50154
50155 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) {
50156         LDKCommitmentUpdate this_ptr_conv;
50157         this_ptr_conv.inner = untag_ptr(this_ptr);
50158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50160         this_ptr_conv.is_owned = false;
50161         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
50162         val_constr.datalen = (*env)->GetArrayLength(env, val);
50163         if (val_constr.datalen > 0)
50164                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50165         else
50166                 val_constr.data = NULL;
50167         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50168         for (size_t z = 0; z < val_constr.datalen; z++) {
50169                 int64_t val_conv_25 = val_vals[z];
50170                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
50171                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
50172                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
50173                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
50174                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
50175                 val_constr.data[z] = val_conv_25_conv;
50176         }
50177         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50178         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
50179 }
50180
50181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
50182         LDKCommitmentUpdate this_ptr_conv;
50183         this_ptr_conv.inner = untag_ptr(this_ptr);
50184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50186         this_ptr_conv.is_owned = false;
50187         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
50188         int64_t ret_ref = 0;
50189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50191         return ret_ref;
50192 }
50193
50194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50195         LDKCommitmentUpdate this_ptr_conv;
50196         this_ptr_conv.inner = untag_ptr(this_ptr);
50197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50199         this_ptr_conv.is_owned = false;
50200         LDKUpdateFee val_conv;
50201         val_conv.inner = untag_ptr(val);
50202         val_conv.is_owned = ptr_is_owned(val);
50203         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50204         val_conv = UpdateFee_clone(&val_conv);
50205         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
50206 }
50207
50208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
50209         LDKCommitmentUpdate this_ptr_conv;
50210         this_ptr_conv.inner = untag_ptr(this_ptr);
50211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50213         this_ptr_conv.is_owned = false;
50214         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
50215         int64_t ret_ref = 0;
50216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50218         return ret_ref;
50219 }
50220
50221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50222         LDKCommitmentUpdate this_ptr_conv;
50223         this_ptr_conv.inner = untag_ptr(this_ptr);
50224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50226         this_ptr_conv.is_owned = false;
50227         LDKCommitmentSigned val_conv;
50228         val_conv.inner = untag_ptr(val);
50229         val_conv.is_owned = ptr_is_owned(val);
50230         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50231         val_conv = CommitmentSigned_clone(&val_conv);
50232         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
50233 }
50234
50235 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) {
50236         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
50237         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
50238         if (update_add_htlcs_arg_constr.datalen > 0)
50239                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50240         else
50241                 update_add_htlcs_arg_constr.data = NULL;
50242         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
50243         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
50244                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
50245                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
50246                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
50247                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
50248                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
50249                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
50250                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
50251         }
50252         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
50253         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
50254         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
50255         if (update_fulfill_htlcs_arg_constr.datalen > 0)
50256                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50257         else
50258                 update_fulfill_htlcs_arg_constr.data = NULL;
50259         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
50260         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
50261                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
50262                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
50263                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
50264                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
50265                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
50266                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
50267                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
50268         }
50269         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
50270         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
50271         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
50272         if (update_fail_htlcs_arg_constr.datalen > 0)
50273                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50274         else
50275                 update_fail_htlcs_arg_constr.data = NULL;
50276         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
50277         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
50278                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
50279                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
50280                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
50281                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
50282                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
50283                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
50284                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
50285         }
50286         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
50287         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
50288         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
50289         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
50290                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50291         else
50292                 update_fail_malformed_htlcs_arg_constr.data = NULL;
50293         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
50294         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
50295                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
50296                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
50297                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
50298                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
50299                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
50300                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
50301                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
50302         }
50303         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
50304         LDKUpdateFee update_fee_arg_conv;
50305         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
50306         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
50307         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
50308         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
50309         LDKCommitmentSigned commitment_signed_arg_conv;
50310         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
50311         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
50312         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
50313         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
50314         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);
50315         int64_t ret_ref = 0;
50316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50318         return ret_ref;
50319 }
50320
50321 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
50322         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
50323         int64_t ret_ref = 0;
50324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50326         return ret_ref;
50327 }
50328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50329         LDKCommitmentUpdate arg_conv;
50330         arg_conv.inner = untag_ptr(arg);
50331         arg_conv.is_owned = ptr_is_owned(arg);
50332         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50333         arg_conv.is_owned = false;
50334         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
50335         return ret_conv;
50336 }
50337
50338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50339         LDKCommitmentUpdate orig_conv;
50340         orig_conv.inner = untag_ptr(orig);
50341         orig_conv.is_owned = ptr_is_owned(orig);
50342         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50343         orig_conv.is_owned = false;
50344         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
50345         int64_t ret_ref = 0;
50346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50348         return ret_ref;
50349 }
50350
50351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50352         LDKCommitmentUpdate a_conv;
50353         a_conv.inner = untag_ptr(a);
50354         a_conv.is_owned = ptr_is_owned(a);
50355         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50356         a_conv.is_owned = false;
50357         LDKCommitmentUpdate b_conv;
50358         b_conv.inner = untag_ptr(b);
50359         b_conv.is_owned = ptr_is_owned(b);
50360         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50361         b_conv.is_owned = false;
50362         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
50363         return ret_conv;
50364 }
50365
50366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50367         if (!ptr_is_owned(this_ptr)) return;
50368         void* this_ptr_ptr = untag_ptr(this_ptr);
50369         CHECK_ACCESS(this_ptr_ptr);
50370         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
50371         FREE(untag_ptr(this_ptr));
50372         ChannelMessageHandler_free(this_ptr_conv);
50373 }
50374
50375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50376         if (!ptr_is_owned(this_ptr)) return;
50377         void* this_ptr_ptr = untag_ptr(this_ptr);
50378         CHECK_ACCESS(this_ptr_ptr);
50379         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
50380         FREE(untag_ptr(this_ptr));
50381         RoutingMessageHandler_free(this_ptr_conv);
50382 }
50383
50384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50385         if (!ptr_is_owned(this_ptr)) return;
50386         void* this_ptr_ptr = untag_ptr(this_ptr);
50387         CHECK_ACCESS(this_ptr_ptr);
50388         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
50389         FREE(untag_ptr(this_ptr));
50390         OnionMessageHandler_free(this_ptr_conv);
50391 }
50392
50393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
50394         LDKAcceptChannel obj_conv;
50395         obj_conv.inner = untag_ptr(obj);
50396         obj_conv.is_owned = ptr_is_owned(obj);
50397         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50398         obj_conv.is_owned = false;
50399         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
50400         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50401         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50402         CVec_u8Z_free(ret_var);
50403         return ret_arr;
50404 }
50405
50406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50407         LDKu8slice ser_ref;
50408         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50409         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50410         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
50411         *ret_conv = AcceptChannel_read(ser_ref);
50412         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50413         return tag_ptr(ret_conv, true);
50414 }
50415
50416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
50417         LDKAcceptChannelV2 obj_conv;
50418         obj_conv.inner = untag_ptr(obj);
50419         obj_conv.is_owned = ptr_is_owned(obj);
50420         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50421         obj_conv.is_owned = false;
50422         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
50423         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50424         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50425         CVec_u8Z_free(ret_var);
50426         return ret_arr;
50427 }
50428
50429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50430         LDKu8slice ser_ref;
50431         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50432         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50433         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
50434         *ret_conv = AcceptChannelV2_read(ser_ref);
50435         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50436         return tag_ptr(ret_conv, true);
50437 }
50438
50439 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
50440         LDKTxAddInput obj_conv;
50441         obj_conv.inner = untag_ptr(obj);
50442         obj_conv.is_owned = ptr_is_owned(obj);
50443         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50444         obj_conv.is_owned = false;
50445         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
50446         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50447         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50448         CVec_u8Z_free(ret_var);
50449         return ret_arr;
50450 }
50451
50452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50453         LDKu8slice ser_ref;
50454         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50455         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50456         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
50457         *ret_conv = TxAddInput_read(ser_ref);
50458         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50459         return tag_ptr(ret_conv, true);
50460 }
50461
50462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
50463         LDKTxAddOutput obj_conv;
50464         obj_conv.inner = untag_ptr(obj);
50465         obj_conv.is_owned = ptr_is_owned(obj);
50466         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50467         obj_conv.is_owned = false;
50468         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
50469         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50470         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50471         CVec_u8Z_free(ret_var);
50472         return ret_arr;
50473 }
50474
50475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50476         LDKu8slice ser_ref;
50477         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50478         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50479         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
50480         *ret_conv = TxAddOutput_read(ser_ref);
50481         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50482         return tag_ptr(ret_conv, true);
50483 }
50484
50485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
50486         LDKTxRemoveInput obj_conv;
50487         obj_conv.inner = untag_ptr(obj);
50488         obj_conv.is_owned = ptr_is_owned(obj);
50489         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50490         obj_conv.is_owned = false;
50491         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
50492         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50493         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50494         CVec_u8Z_free(ret_var);
50495         return ret_arr;
50496 }
50497
50498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50499         LDKu8slice ser_ref;
50500         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50501         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50502         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
50503         *ret_conv = TxRemoveInput_read(ser_ref);
50504         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50505         return tag_ptr(ret_conv, true);
50506 }
50507
50508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
50509         LDKTxRemoveOutput obj_conv;
50510         obj_conv.inner = untag_ptr(obj);
50511         obj_conv.is_owned = ptr_is_owned(obj);
50512         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50513         obj_conv.is_owned = false;
50514         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
50515         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50516         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50517         CVec_u8Z_free(ret_var);
50518         return ret_arr;
50519 }
50520
50521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50522         LDKu8slice ser_ref;
50523         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50524         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50525         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
50526         *ret_conv = TxRemoveOutput_read(ser_ref);
50527         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50528         return tag_ptr(ret_conv, true);
50529 }
50530
50531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
50532         LDKTxComplete obj_conv;
50533         obj_conv.inner = untag_ptr(obj);
50534         obj_conv.is_owned = ptr_is_owned(obj);
50535         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50536         obj_conv.is_owned = false;
50537         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
50538         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50539         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50540         CVec_u8Z_free(ret_var);
50541         return ret_arr;
50542 }
50543
50544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50545         LDKu8slice ser_ref;
50546         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50547         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50548         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
50549         *ret_conv = TxComplete_read(ser_ref);
50550         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50551         return tag_ptr(ret_conv, true);
50552 }
50553
50554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
50555         LDKTxSignatures obj_conv;
50556         obj_conv.inner = untag_ptr(obj);
50557         obj_conv.is_owned = ptr_is_owned(obj);
50558         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50559         obj_conv.is_owned = false;
50560         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
50561         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50562         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50563         CVec_u8Z_free(ret_var);
50564         return ret_arr;
50565 }
50566
50567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50568         LDKu8slice ser_ref;
50569         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50570         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50571         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
50572         *ret_conv = TxSignatures_read(ser_ref);
50573         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50574         return tag_ptr(ret_conv, true);
50575 }
50576
50577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
50578         LDKTxInitRbf obj_conv;
50579         obj_conv.inner = untag_ptr(obj);
50580         obj_conv.is_owned = ptr_is_owned(obj);
50581         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50582         obj_conv.is_owned = false;
50583         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
50584         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50585         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50586         CVec_u8Z_free(ret_var);
50587         return ret_arr;
50588 }
50589
50590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50591         LDKu8slice ser_ref;
50592         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50593         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50594         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
50595         *ret_conv = TxInitRbf_read(ser_ref);
50596         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50597         return tag_ptr(ret_conv, true);
50598 }
50599
50600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
50601         LDKTxAckRbf obj_conv;
50602         obj_conv.inner = untag_ptr(obj);
50603         obj_conv.is_owned = ptr_is_owned(obj);
50604         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50605         obj_conv.is_owned = false;
50606         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
50607         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50608         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50609         CVec_u8Z_free(ret_var);
50610         return ret_arr;
50611 }
50612
50613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50614         LDKu8slice ser_ref;
50615         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50616         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50617         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
50618         *ret_conv = TxAckRbf_read(ser_ref);
50619         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50620         return tag_ptr(ret_conv, true);
50621 }
50622
50623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
50624         LDKTxAbort obj_conv;
50625         obj_conv.inner = untag_ptr(obj);
50626         obj_conv.is_owned = ptr_is_owned(obj);
50627         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50628         obj_conv.is_owned = false;
50629         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
50630         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50631         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50632         CVec_u8Z_free(ret_var);
50633         return ret_arr;
50634 }
50635
50636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50637         LDKu8slice ser_ref;
50638         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50639         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50640         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
50641         *ret_conv = TxAbort_read(ser_ref);
50642         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50643         return tag_ptr(ret_conv, true);
50644 }
50645
50646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
50647         LDKAnnouncementSignatures obj_conv;
50648         obj_conv.inner = untag_ptr(obj);
50649         obj_conv.is_owned = ptr_is_owned(obj);
50650         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50651         obj_conv.is_owned = false;
50652         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
50653         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50654         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50655         CVec_u8Z_free(ret_var);
50656         return ret_arr;
50657 }
50658
50659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50660         LDKu8slice ser_ref;
50661         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50662         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50663         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
50664         *ret_conv = AnnouncementSignatures_read(ser_ref);
50665         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50666         return tag_ptr(ret_conv, true);
50667 }
50668
50669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
50670         LDKChannelReestablish obj_conv;
50671         obj_conv.inner = untag_ptr(obj);
50672         obj_conv.is_owned = ptr_is_owned(obj);
50673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50674         obj_conv.is_owned = false;
50675         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
50676         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50677         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50678         CVec_u8Z_free(ret_var);
50679         return ret_arr;
50680 }
50681
50682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50683         LDKu8slice ser_ref;
50684         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50685         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50686         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
50687         *ret_conv = ChannelReestablish_read(ser_ref);
50688         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50689         return tag_ptr(ret_conv, true);
50690 }
50691
50692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
50693         LDKClosingSigned obj_conv;
50694         obj_conv.inner = untag_ptr(obj);
50695         obj_conv.is_owned = ptr_is_owned(obj);
50696         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50697         obj_conv.is_owned = false;
50698         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
50699         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50700         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50701         CVec_u8Z_free(ret_var);
50702         return ret_arr;
50703 }
50704
50705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50706         LDKu8slice ser_ref;
50707         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50708         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50709         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
50710         *ret_conv = ClosingSigned_read(ser_ref);
50711         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50712         return tag_ptr(ret_conv, true);
50713 }
50714
50715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
50716         LDKClosingSignedFeeRange obj_conv;
50717         obj_conv.inner = untag_ptr(obj);
50718         obj_conv.is_owned = ptr_is_owned(obj);
50719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50720         obj_conv.is_owned = false;
50721         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
50722         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50723         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50724         CVec_u8Z_free(ret_var);
50725         return ret_arr;
50726 }
50727
50728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50729         LDKu8slice ser_ref;
50730         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50731         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50732         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
50733         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
50734         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50735         return tag_ptr(ret_conv, true);
50736 }
50737
50738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
50739         LDKCommitmentSigned obj_conv;
50740         obj_conv.inner = untag_ptr(obj);
50741         obj_conv.is_owned = ptr_is_owned(obj);
50742         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50743         obj_conv.is_owned = false;
50744         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
50745         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50746         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50747         CVec_u8Z_free(ret_var);
50748         return ret_arr;
50749 }
50750
50751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50752         LDKu8slice ser_ref;
50753         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50754         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50755         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
50756         *ret_conv = CommitmentSigned_read(ser_ref);
50757         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50758         return tag_ptr(ret_conv, true);
50759 }
50760
50761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
50762         LDKFundingCreated obj_conv;
50763         obj_conv.inner = untag_ptr(obj);
50764         obj_conv.is_owned = ptr_is_owned(obj);
50765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50766         obj_conv.is_owned = false;
50767         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
50768         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50769         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50770         CVec_u8Z_free(ret_var);
50771         return ret_arr;
50772 }
50773
50774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50775         LDKu8slice ser_ref;
50776         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50777         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50778         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
50779         *ret_conv = FundingCreated_read(ser_ref);
50780         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50781         return tag_ptr(ret_conv, true);
50782 }
50783
50784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
50785         LDKFundingSigned obj_conv;
50786         obj_conv.inner = untag_ptr(obj);
50787         obj_conv.is_owned = ptr_is_owned(obj);
50788         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50789         obj_conv.is_owned = false;
50790         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
50791         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50792         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50793         CVec_u8Z_free(ret_var);
50794         return ret_arr;
50795 }
50796
50797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50798         LDKu8slice ser_ref;
50799         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50800         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50801         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
50802         *ret_conv = FundingSigned_read(ser_ref);
50803         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50804         return tag_ptr(ret_conv, true);
50805 }
50806
50807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
50808         LDKChannelReady obj_conv;
50809         obj_conv.inner = untag_ptr(obj);
50810         obj_conv.is_owned = ptr_is_owned(obj);
50811         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50812         obj_conv.is_owned = false;
50813         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
50814         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50815         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50816         CVec_u8Z_free(ret_var);
50817         return ret_arr;
50818 }
50819
50820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50821         LDKu8slice ser_ref;
50822         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50823         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50824         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
50825         *ret_conv = ChannelReady_read(ser_ref);
50826         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50827         return tag_ptr(ret_conv, true);
50828 }
50829
50830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
50831         LDKInit obj_conv;
50832         obj_conv.inner = untag_ptr(obj);
50833         obj_conv.is_owned = ptr_is_owned(obj);
50834         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50835         obj_conv.is_owned = false;
50836         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
50837         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50838         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50839         CVec_u8Z_free(ret_var);
50840         return ret_arr;
50841 }
50842
50843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50844         LDKu8slice ser_ref;
50845         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50846         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50847         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
50848         *ret_conv = Init_read(ser_ref);
50849         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50850         return tag_ptr(ret_conv, true);
50851 }
50852
50853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
50854         LDKOpenChannel obj_conv;
50855         obj_conv.inner = untag_ptr(obj);
50856         obj_conv.is_owned = ptr_is_owned(obj);
50857         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50858         obj_conv.is_owned = false;
50859         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
50860         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50861         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50862         CVec_u8Z_free(ret_var);
50863         return ret_arr;
50864 }
50865
50866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50867         LDKu8slice ser_ref;
50868         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50869         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50870         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
50871         *ret_conv = OpenChannel_read(ser_ref);
50872         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50873         return tag_ptr(ret_conv, true);
50874 }
50875
50876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
50877         LDKOpenChannelV2 obj_conv;
50878         obj_conv.inner = untag_ptr(obj);
50879         obj_conv.is_owned = ptr_is_owned(obj);
50880         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50881         obj_conv.is_owned = false;
50882         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
50883         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50884         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50885         CVec_u8Z_free(ret_var);
50886         return ret_arr;
50887 }
50888
50889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50890         LDKu8slice ser_ref;
50891         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50892         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50893         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
50894         *ret_conv = OpenChannelV2_read(ser_ref);
50895         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50896         return tag_ptr(ret_conv, true);
50897 }
50898
50899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
50900         LDKRevokeAndACK obj_conv;
50901         obj_conv.inner = untag_ptr(obj);
50902         obj_conv.is_owned = ptr_is_owned(obj);
50903         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50904         obj_conv.is_owned = false;
50905         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
50906         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50907         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50908         CVec_u8Z_free(ret_var);
50909         return ret_arr;
50910 }
50911
50912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50913         LDKu8slice ser_ref;
50914         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50915         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50916         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
50917         *ret_conv = RevokeAndACK_read(ser_ref);
50918         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50919         return tag_ptr(ret_conv, true);
50920 }
50921
50922 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
50923         LDKShutdown obj_conv;
50924         obj_conv.inner = untag_ptr(obj);
50925         obj_conv.is_owned = ptr_is_owned(obj);
50926         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50927         obj_conv.is_owned = false;
50928         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
50929         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50930         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50931         CVec_u8Z_free(ret_var);
50932         return ret_arr;
50933 }
50934
50935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50936         LDKu8slice ser_ref;
50937         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50938         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50939         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
50940         *ret_conv = Shutdown_read(ser_ref);
50941         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50942         return tag_ptr(ret_conv, true);
50943 }
50944
50945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
50946         LDKUpdateFailHTLC obj_conv;
50947         obj_conv.inner = untag_ptr(obj);
50948         obj_conv.is_owned = ptr_is_owned(obj);
50949         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50950         obj_conv.is_owned = false;
50951         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
50952         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50953         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50954         CVec_u8Z_free(ret_var);
50955         return ret_arr;
50956 }
50957
50958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50959         LDKu8slice ser_ref;
50960         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50961         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50962         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
50963         *ret_conv = UpdateFailHTLC_read(ser_ref);
50964         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50965         return tag_ptr(ret_conv, true);
50966 }
50967
50968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
50969         LDKUpdateFailMalformedHTLC obj_conv;
50970         obj_conv.inner = untag_ptr(obj);
50971         obj_conv.is_owned = ptr_is_owned(obj);
50972         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50973         obj_conv.is_owned = false;
50974         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
50975         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50976         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50977         CVec_u8Z_free(ret_var);
50978         return ret_arr;
50979 }
50980
50981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50982         LDKu8slice ser_ref;
50983         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50984         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50985         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
50986         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
50987         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50988         return tag_ptr(ret_conv, true);
50989 }
50990
50991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
50992         LDKUpdateFee obj_conv;
50993         obj_conv.inner = untag_ptr(obj);
50994         obj_conv.is_owned = ptr_is_owned(obj);
50995         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50996         obj_conv.is_owned = false;
50997         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
50998         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50999         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51000         CVec_u8Z_free(ret_var);
51001         return ret_arr;
51002 }
51003
51004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51005         LDKu8slice ser_ref;
51006         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51007         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51008         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
51009         *ret_conv = UpdateFee_read(ser_ref);
51010         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51011         return tag_ptr(ret_conv, true);
51012 }
51013
51014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51015         LDKUpdateFulfillHTLC obj_conv;
51016         obj_conv.inner = untag_ptr(obj);
51017         obj_conv.is_owned = ptr_is_owned(obj);
51018         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51019         obj_conv.is_owned = false;
51020         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
51021         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51022         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51023         CVec_u8Z_free(ret_var);
51024         return ret_arr;
51025 }
51026
51027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51028         LDKu8slice ser_ref;
51029         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51030         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51031         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
51032         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
51033         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51034         return tag_ptr(ret_conv, true);
51035 }
51036
51037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51038         LDKUpdateAddHTLC obj_conv;
51039         obj_conv.inner = untag_ptr(obj);
51040         obj_conv.is_owned = ptr_is_owned(obj);
51041         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51042         obj_conv.is_owned = false;
51043         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
51044         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51045         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51046         CVec_u8Z_free(ret_var);
51047         return ret_arr;
51048 }
51049
51050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51051         LDKu8slice ser_ref;
51052         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51053         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51054         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
51055         *ret_conv = UpdateAddHTLC_read(ser_ref);
51056         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51057         return tag_ptr(ret_conv, true);
51058 }
51059
51060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51061         LDKu8slice ser_ref;
51062         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51063         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51064         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
51065         *ret_conv = OnionMessage_read(ser_ref);
51066         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51067         return tag_ptr(ret_conv, true);
51068 }
51069
51070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51071         LDKOnionMessage obj_conv;
51072         obj_conv.inner = untag_ptr(obj);
51073         obj_conv.is_owned = ptr_is_owned(obj);
51074         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51075         obj_conv.is_owned = false;
51076         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
51077         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51078         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51079         CVec_u8Z_free(ret_var);
51080         return ret_arr;
51081 }
51082
51083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
51084         LDKPing obj_conv;
51085         obj_conv.inner = untag_ptr(obj);
51086         obj_conv.is_owned = ptr_is_owned(obj);
51087         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51088         obj_conv.is_owned = false;
51089         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
51090         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51091         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51092         CVec_u8Z_free(ret_var);
51093         return ret_arr;
51094 }
51095
51096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51097         LDKu8slice ser_ref;
51098         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51099         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51100         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
51101         *ret_conv = Ping_read(ser_ref);
51102         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51103         return tag_ptr(ret_conv, true);
51104 }
51105
51106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
51107         LDKPong obj_conv;
51108         obj_conv.inner = untag_ptr(obj);
51109         obj_conv.is_owned = ptr_is_owned(obj);
51110         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51111         obj_conv.is_owned = false;
51112         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
51113         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51114         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51115         CVec_u8Z_free(ret_var);
51116         return ret_arr;
51117 }
51118
51119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51120         LDKu8slice ser_ref;
51121         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51122         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51123         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
51124         *ret_conv = Pong_read(ser_ref);
51125         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51126         return tag_ptr(ret_conv, true);
51127 }
51128
51129 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51130         LDKUnsignedChannelAnnouncement obj_conv;
51131         obj_conv.inner = untag_ptr(obj);
51132         obj_conv.is_owned = ptr_is_owned(obj);
51133         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51134         obj_conv.is_owned = false;
51135         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
51136         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51137         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51138         CVec_u8Z_free(ret_var);
51139         return ret_arr;
51140 }
51141
51142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51143         LDKu8slice ser_ref;
51144         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51145         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51146         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
51147         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
51148         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51149         return tag_ptr(ret_conv, true);
51150 }
51151
51152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51153         LDKChannelAnnouncement obj_conv;
51154         obj_conv.inner = untag_ptr(obj);
51155         obj_conv.is_owned = ptr_is_owned(obj);
51156         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51157         obj_conv.is_owned = false;
51158         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
51159         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51160         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51161         CVec_u8Z_free(ret_var);
51162         return ret_arr;
51163 }
51164
51165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51166         LDKu8slice ser_ref;
51167         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51168         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51169         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
51170         *ret_conv = ChannelAnnouncement_read(ser_ref);
51171         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51172         return tag_ptr(ret_conv, true);
51173 }
51174
51175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
51176         LDKUnsignedChannelUpdate obj_conv;
51177         obj_conv.inner = untag_ptr(obj);
51178         obj_conv.is_owned = ptr_is_owned(obj);
51179         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51180         obj_conv.is_owned = false;
51181         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
51182         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51183         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51184         CVec_u8Z_free(ret_var);
51185         return ret_arr;
51186 }
51187
51188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51189         LDKu8slice ser_ref;
51190         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51191         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51192         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
51193         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
51194         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51195         return tag_ptr(ret_conv, true);
51196 }
51197
51198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
51199         LDKChannelUpdate obj_conv;
51200         obj_conv.inner = untag_ptr(obj);
51201         obj_conv.is_owned = ptr_is_owned(obj);
51202         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51203         obj_conv.is_owned = false;
51204         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
51205         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51206         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51207         CVec_u8Z_free(ret_var);
51208         return ret_arr;
51209 }
51210
51211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51212         LDKu8slice ser_ref;
51213         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51214         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51215         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
51216         *ret_conv = ChannelUpdate_read(ser_ref);
51217         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51218         return tag_ptr(ret_conv, true);
51219 }
51220
51221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51222         LDKErrorMessage obj_conv;
51223         obj_conv.inner = untag_ptr(obj);
51224         obj_conv.is_owned = ptr_is_owned(obj);
51225         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51226         obj_conv.is_owned = false;
51227         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
51228         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51229         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51230         CVec_u8Z_free(ret_var);
51231         return ret_arr;
51232 }
51233
51234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51235         LDKu8slice ser_ref;
51236         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51237         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51238         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
51239         *ret_conv = ErrorMessage_read(ser_ref);
51240         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51241         return tag_ptr(ret_conv, true);
51242 }
51243
51244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51245         LDKWarningMessage obj_conv;
51246         obj_conv.inner = untag_ptr(obj);
51247         obj_conv.is_owned = ptr_is_owned(obj);
51248         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51249         obj_conv.is_owned = false;
51250         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
51251         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51252         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51253         CVec_u8Z_free(ret_var);
51254         return ret_arr;
51255 }
51256
51257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51258         LDKu8slice ser_ref;
51259         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51260         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51261         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
51262         *ret_conv = WarningMessage_read(ser_ref);
51263         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51264         return tag_ptr(ret_conv, true);
51265 }
51266
51267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51268         LDKUnsignedNodeAnnouncement obj_conv;
51269         obj_conv.inner = untag_ptr(obj);
51270         obj_conv.is_owned = ptr_is_owned(obj);
51271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51272         obj_conv.is_owned = false;
51273         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
51274         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51275         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51276         CVec_u8Z_free(ret_var);
51277         return ret_arr;
51278 }
51279
51280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51281         LDKu8slice ser_ref;
51282         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51283         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51284         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
51285         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
51286         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51287         return tag_ptr(ret_conv, true);
51288 }
51289
51290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51291         LDKNodeAnnouncement obj_conv;
51292         obj_conv.inner = untag_ptr(obj);
51293         obj_conv.is_owned = ptr_is_owned(obj);
51294         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51295         obj_conv.is_owned = false;
51296         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
51297         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51298         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51299         CVec_u8Z_free(ret_var);
51300         return ret_arr;
51301 }
51302
51303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51304         LDKu8slice ser_ref;
51305         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51306         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51307         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
51308         *ret_conv = NodeAnnouncement_read(ser_ref);
51309         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51310         return tag_ptr(ret_conv, true);
51311 }
51312
51313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51314         LDKu8slice ser_ref;
51315         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51316         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51317         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
51318         *ret_conv = QueryShortChannelIds_read(ser_ref);
51319         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51320         return tag_ptr(ret_conv, true);
51321 }
51322
51323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
51324         LDKQueryShortChannelIds obj_conv;
51325         obj_conv.inner = untag_ptr(obj);
51326         obj_conv.is_owned = ptr_is_owned(obj);
51327         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51328         obj_conv.is_owned = false;
51329         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
51330         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51331         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51332         CVec_u8Z_free(ret_var);
51333         return ret_arr;
51334 }
51335
51336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
51337         LDKReplyShortChannelIdsEnd obj_conv;
51338         obj_conv.inner = untag_ptr(obj);
51339         obj_conv.is_owned = ptr_is_owned(obj);
51340         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51341         obj_conv.is_owned = false;
51342         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
51343         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51344         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51345         CVec_u8Z_free(ret_var);
51346         return ret_arr;
51347 }
51348
51349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51350         LDKu8slice ser_ref;
51351         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51352         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51353         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
51354         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
51355         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51356         return tag_ptr(ret_conv, true);
51357 }
51358
51359 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
51360         LDKQueryChannelRange this_arg_conv;
51361         this_arg_conv.inner = untag_ptr(this_arg);
51362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51364         this_arg_conv.is_owned = false;
51365         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
51366         return ret_conv;
51367 }
51368
51369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
51370         LDKQueryChannelRange obj_conv;
51371         obj_conv.inner = untag_ptr(obj);
51372         obj_conv.is_owned = ptr_is_owned(obj);
51373         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51374         obj_conv.is_owned = false;
51375         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
51376         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51377         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51378         CVec_u8Z_free(ret_var);
51379         return ret_arr;
51380 }
51381
51382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51383         LDKu8slice ser_ref;
51384         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51385         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51386         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
51387         *ret_conv = QueryChannelRange_read(ser_ref);
51388         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51389         return tag_ptr(ret_conv, true);
51390 }
51391
51392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51393         LDKu8slice ser_ref;
51394         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51395         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51396         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
51397         *ret_conv = ReplyChannelRange_read(ser_ref);
51398         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51399         return tag_ptr(ret_conv, true);
51400 }
51401
51402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
51403         LDKReplyChannelRange obj_conv;
51404         obj_conv.inner = untag_ptr(obj);
51405         obj_conv.is_owned = ptr_is_owned(obj);
51406         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51407         obj_conv.is_owned = false;
51408         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
51409         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51410         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51411         CVec_u8Z_free(ret_var);
51412         return ret_arr;
51413 }
51414
51415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
51416         LDKGossipTimestampFilter obj_conv;
51417         obj_conv.inner = untag_ptr(obj);
51418         obj_conv.is_owned = ptr_is_owned(obj);
51419         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51420         obj_conv.is_owned = false;
51421         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
51422         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51423         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51424         CVec_u8Z_free(ret_var);
51425         return ret_arr;
51426 }
51427
51428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51429         LDKu8slice ser_ref;
51430         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51431         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51432         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
51433         *ret_conv = GossipTimestampFilter_read(ser_ref);
51434         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51435         return tag_ptr(ret_conv, true);
51436 }
51437
51438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51439         if (!ptr_is_owned(this_ptr)) return;
51440         void* this_ptr_ptr = untag_ptr(this_ptr);
51441         CHECK_ACCESS(this_ptr_ptr);
51442         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
51443         FREE(untag_ptr(this_ptr));
51444         CustomMessageHandler_free(this_ptr_conv);
51445 }
51446
51447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51448         LDKIgnoringMessageHandler this_obj_conv;
51449         this_obj_conv.inner = untag_ptr(this_obj);
51450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51452         IgnoringMessageHandler_free(this_obj_conv);
51453 }
51454
51455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
51456         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
51457         int64_t ret_ref = 0;
51458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51460         return ret_ref;
51461 }
51462
51463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
51464         LDKIgnoringMessageHandler this_arg_conv;
51465         this_arg_conv.inner = untag_ptr(this_arg);
51466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51468         this_arg_conv.is_owned = false;
51469         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
51470         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
51471         return tag_ptr(ret_ret, true);
51472 }
51473
51474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51475         LDKIgnoringMessageHandler this_arg_conv;
51476         this_arg_conv.inner = untag_ptr(this_arg);
51477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51479         this_arg_conv.is_owned = false;
51480         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
51481         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
51482         return tag_ptr(ret_ret, true);
51483 }
51484
51485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
51486         LDKIgnoringMessageHandler this_arg_conv;
51487         this_arg_conv.inner = untag_ptr(this_arg);
51488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51490         this_arg_conv.is_owned = false;
51491         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
51492         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
51493         return tag_ptr(ret_ret, true);
51494 }
51495
51496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51497         LDKIgnoringMessageHandler this_arg_conv;
51498         this_arg_conv.inner = untag_ptr(this_arg);
51499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51501         this_arg_conv.is_owned = false;
51502         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
51503         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
51504         return tag_ptr(ret_ret, true);
51505 }
51506
51507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51508         LDKIgnoringMessageHandler this_arg_conv;
51509         this_arg_conv.inner = untag_ptr(this_arg);
51510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51512         this_arg_conv.is_owned = false;
51513         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
51514         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
51515         return tag_ptr(ret_ret, true);
51516 }
51517
51518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51519         LDKIgnoringMessageHandler this_arg_conv;
51520         this_arg_conv.inner = untag_ptr(this_arg);
51521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51523         this_arg_conv.is_owned = false;
51524         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
51525         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
51526         return tag_ptr(ret_ret, true);
51527 }
51528
51529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
51530         LDKIgnoringMessageHandler this_arg_conv;
51531         this_arg_conv.inner = untag_ptr(this_arg);
51532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51534         this_arg_conv.is_owned = false;
51535         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
51536         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
51537         return tag_ptr(ret_ret, true);
51538 }
51539
51540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51541         LDKIgnoringMessageHandler this_arg_conv;
51542         this_arg_conv.inner = untag_ptr(this_arg);
51543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51545         this_arg_conv.is_owned = false;
51546         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
51547         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
51548         return tag_ptr(ret_ret, true);
51549 }
51550
51551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51552         LDKErroringMessageHandler this_obj_conv;
51553         this_obj_conv.inner = untag_ptr(this_obj);
51554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51556         ErroringMessageHandler_free(this_obj_conv);
51557 }
51558
51559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
51560         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
51561         int64_t ret_ref = 0;
51562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51564         return ret_ref;
51565 }
51566
51567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
51568         LDKErroringMessageHandler this_arg_conv;
51569         this_arg_conv.inner = untag_ptr(this_arg);
51570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51572         this_arg_conv.is_owned = false;
51573         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
51574         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
51575         return tag_ptr(ret_ret, true);
51576 }
51577
51578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
51579         LDKErroringMessageHandler this_arg_conv;
51580         this_arg_conv.inner = untag_ptr(this_arg);
51581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51583         this_arg_conv.is_owned = false;
51584         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
51585         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
51586         return tag_ptr(ret_ret, true);
51587 }
51588
51589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51590         LDKMessageHandler this_obj_conv;
51591         this_obj_conv.inner = untag_ptr(this_obj);
51592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51594         MessageHandler_free(this_obj_conv);
51595 }
51596
51597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
51598         LDKMessageHandler this_ptr_conv;
51599         this_ptr_conv.inner = untag_ptr(this_ptr);
51600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51602         this_ptr_conv.is_owned = false;
51603         // WARNING: This object doesn't live past this scope, needs clone!
51604         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
51605         return ret_ret;
51606 }
51607
51608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51609         LDKMessageHandler this_ptr_conv;
51610         this_ptr_conv.inner = untag_ptr(this_ptr);
51611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51613         this_ptr_conv.is_owned = false;
51614         void* val_ptr = untag_ptr(val);
51615         CHECK_ACCESS(val_ptr);
51616         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
51617         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
51618                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51619                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
51620         }
51621         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
51622 }
51623
51624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
51625         LDKMessageHandler this_ptr_conv;
51626         this_ptr_conv.inner = untag_ptr(this_ptr);
51627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51629         this_ptr_conv.is_owned = false;
51630         // WARNING: This object doesn't live past this scope, needs clone!
51631         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
51632         return ret_ret;
51633 }
51634
51635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51636         LDKMessageHandler this_ptr_conv;
51637         this_ptr_conv.inner = untag_ptr(this_ptr);
51638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51640         this_ptr_conv.is_owned = false;
51641         void* val_ptr = untag_ptr(val);
51642         CHECK_ACCESS(val_ptr);
51643         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
51644         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
51645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51646                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
51647         }
51648         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
51649 }
51650
51651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
51652         LDKMessageHandler this_ptr_conv;
51653         this_ptr_conv.inner = untag_ptr(this_ptr);
51654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51656         this_ptr_conv.is_owned = false;
51657         // WARNING: This object doesn't live past this scope, needs clone!
51658         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
51659         return ret_ret;
51660 }
51661
51662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51663         LDKMessageHandler this_ptr_conv;
51664         this_ptr_conv.inner = untag_ptr(this_ptr);
51665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51667         this_ptr_conv.is_owned = false;
51668         void* val_ptr = untag_ptr(val);
51669         CHECK_ACCESS(val_ptr);
51670         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
51671         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
51672                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51673                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
51674         }
51675         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
51676 }
51677
51678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
51679         LDKMessageHandler this_ptr_conv;
51680         this_ptr_conv.inner = untag_ptr(this_ptr);
51681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51683         this_ptr_conv.is_owned = false;
51684         // WARNING: This object doesn't live past this scope, needs clone!
51685         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
51686         return ret_ret;
51687 }
51688
51689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51690         LDKMessageHandler this_ptr_conv;
51691         this_ptr_conv.inner = untag_ptr(this_ptr);
51692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51694         this_ptr_conv.is_owned = false;
51695         void* val_ptr = untag_ptr(val);
51696         CHECK_ACCESS(val_ptr);
51697         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
51698         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
51699                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51700                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
51701         }
51702         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
51703 }
51704
51705 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, int64_t onion_message_handler_arg, int64_t custom_message_handler_arg) {
51706         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
51707         CHECK_ACCESS(chan_handler_arg_ptr);
51708         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
51709         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
51710                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51711                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
51712         }
51713         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
51714         CHECK_ACCESS(route_handler_arg_ptr);
51715         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
51716         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
51717                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51718                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
51719         }
51720         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
51721         CHECK_ACCESS(onion_message_handler_arg_ptr);
51722         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
51723         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
51724                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51725                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
51726         }
51727         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
51728         CHECK_ACCESS(custom_message_handler_arg_ptr);
51729         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
51730         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
51731                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51732                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
51733         }
51734         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
51735         int64_t ret_ref = 0;
51736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51738         return ret_ref;
51739 }
51740
51741 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
51742         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
51743         *ret_ret = SocketDescriptor_clone(arg);
51744         return tag_ptr(ret_ret, true);
51745 }
51746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51747         void* arg_ptr = untag_ptr(arg);
51748         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
51749         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
51750         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
51751         return ret_conv;
51752 }
51753
51754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51755         void* orig_ptr = untag_ptr(orig);
51756         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
51757         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
51758         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
51759         *ret_ret = SocketDescriptor_clone(orig_conv);
51760         return tag_ptr(ret_ret, true);
51761 }
51762
51763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51764         if (!ptr_is_owned(this_ptr)) return;
51765         void* this_ptr_ptr = untag_ptr(this_ptr);
51766         CHECK_ACCESS(this_ptr_ptr);
51767         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
51768         FREE(untag_ptr(this_ptr));
51769         SocketDescriptor_free(this_ptr_conv);
51770 }
51771
51772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51773         LDKPeerHandleError this_obj_conv;
51774         this_obj_conv.inner = untag_ptr(this_obj);
51775         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51777         PeerHandleError_free(this_obj_conv);
51778 }
51779
51780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
51781         LDKPeerHandleError ret_var = PeerHandleError_new();
51782         int64_t ret_ref = 0;
51783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51785         return ret_ref;
51786 }
51787
51788 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
51789         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
51790         int64_t ret_ref = 0;
51791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51793         return ret_ref;
51794 }
51795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51796         LDKPeerHandleError arg_conv;
51797         arg_conv.inner = untag_ptr(arg);
51798         arg_conv.is_owned = ptr_is_owned(arg);
51799         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51800         arg_conv.is_owned = false;
51801         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
51802         return ret_conv;
51803 }
51804
51805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51806         LDKPeerHandleError orig_conv;
51807         orig_conv.inner = untag_ptr(orig);
51808         orig_conv.is_owned = ptr_is_owned(orig);
51809         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51810         orig_conv.is_owned = false;
51811         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
51812         int64_t ret_ref = 0;
51813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51815         return ret_ref;
51816 }
51817
51818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51819         LDKPeerManager this_obj_conv;
51820         this_obj_conv.inner = untag_ptr(this_obj);
51821         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51823         PeerManager_free(this_obj_conv);
51824 }
51825
51826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int32_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t node_signer) {
51827         LDKMessageHandler message_handler_conv;
51828         message_handler_conv.inner = untag_ptr(message_handler);
51829         message_handler_conv.is_owned = ptr_is_owned(message_handler);
51830         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
51831         // WARNING: we need a move here but no clone is available for LDKMessageHandler
51832         
51833         uint8_t ephemeral_random_data_arr[32];
51834         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
51835         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
51836         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
51837         void* logger_ptr = untag_ptr(logger);
51838         CHECK_ACCESS(logger_ptr);
51839         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
51840         if (logger_conv.free == LDKLogger_JCalls_free) {
51841                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51842                 LDKLogger_JCalls_cloned(&logger_conv);
51843         }
51844         void* node_signer_ptr = untag_ptr(node_signer);
51845         CHECK_ACCESS(node_signer_ptr);
51846         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
51847         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
51848                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51849                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
51850         }
51851         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
51852         int64_t ret_ref = 0;
51853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51855         return ret_ref;
51856 }
51857
51858 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
51859         LDKPeerManager this_arg_conv;
51860         this_arg_conv.inner = untag_ptr(this_arg);
51861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51863         this_arg_conv.is_owned = false;
51864         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
51865         int64_tArray ret_arr = NULL;
51866         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
51867         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
51868         for (size_t r = 0; r < ret_var.datalen; r++) {
51869                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
51870                 *ret_conv_43_conv = ret_var.data[r];
51871                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
51872         }
51873         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
51874         FREE(ret_var.data);
51875         return ret_arr;
51876 }
51877
51878 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, int64_t remote_network_address) {
51879         LDKPeerManager this_arg_conv;
51880         this_arg_conv.inner = untag_ptr(this_arg);
51881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51883         this_arg_conv.is_owned = false;
51884         LDKPublicKey their_node_id_ref;
51885         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
51886         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
51887         void* descriptor_ptr = untag_ptr(descriptor);
51888         CHECK_ACCESS(descriptor_ptr);
51889         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
51890         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
51891                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51892                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
51893         }
51894         void* remote_network_address_ptr = untag_ptr(remote_network_address);
51895         CHECK_ACCESS(remote_network_address_ptr);
51896         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
51897         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
51898         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
51899         return tag_ptr(ret_conv, true);
51900 }
51901
51902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor, int64_t remote_network_address) {
51903         LDKPeerManager this_arg_conv;
51904         this_arg_conv.inner = untag_ptr(this_arg);
51905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51907         this_arg_conv.is_owned = false;
51908         void* descriptor_ptr = untag_ptr(descriptor);
51909         CHECK_ACCESS(descriptor_ptr);
51910         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
51911         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
51912                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51913                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
51914         }
51915         void* remote_network_address_ptr = untag_ptr(remote_network_address);
51916         CHECK_ACCESS(remote_network_address_ptr);
51917         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
51918         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
51919         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
51920         return tag_ptr(ret_conv, true);
51921 }
51922
51923 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) {
51924         LDKPeerManager this_arg_conv;
51925         this_arg_conv.inner = untag_ptr(this_arg);
51926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51928         this_arg_conv.is_owned = false;
51929         void* descriptor_ptr = untag_ptr(descriptor);
51930         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
51931         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
51932         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
51933         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
51934         return tag_ptr(ret_conv, true);
51935 }
51936
51937 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) {
51938         LDKPeerManager this_arg_conv;
51939         this_arg_conv.inner = untag_ptr(this_arg);
51940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51942         this_arg_conv.is_owned = false;
51943         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
51944         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
51945         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
51946         LDKu8slice data_ref;
51947         data_ref.datalen = (*env)->GetArrayLength(env, data);
51948         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
51949         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
51950         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
51951         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
51952         return tag_ptr(ret_conv, true);
51953 }
51954
51955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
51956         LDKPeerManager this_arg_conv;
51957         this_arg_conv.inner = untag_ptr(this_arg);
51958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51960         this_arg_conv.is_owned = false;
51961         PeerManager_process_events(&this_arg_conv);
51962 }
51963
51964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
51965         LDKPeerManager this_arg_conv;
51966         this_arg_conv.inner = untag_ptr(this_arg);
51967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51969         this_arg_conv.is_owned = false;
51970         void* descriptor_ptr = untag_ptr(descriptor);
51971         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
51972         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
51973         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
51974 }
51975
51976 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) {
51977         LDKPeerManager this_arg_conv;
51978         this_arg_conv.inner = untag_ptr(this_arg);
51979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51981         this_arg_conv.is_owned = false;
51982         LDKPublicKey node_id_ref;
51983         CHECK((*env)->GetArrayLength(env, node_id) == 33);
51984         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
51985         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
51986 }
51987
51988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
51989         LDKPeerManager this_arg_conv;
51990         this_arg_conv.inner = untag_ptr(this_arg);
51991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51993         this_arg_conv.is_owned = false;
51994         PeerManager_disconnect_all_peers(&this_arg_conv);
51995 }
51996
51997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
51998         LDKPeerManager this_arg_conv;
51999         this_arg_conv.inner = untag_ptr(this_arg);
52000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52002         this_arg_conv.is_owned = false;
52003         PeerManager_timer_tick_occurred(&this_arg_conv);
52004 }
52005
52006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
52007         LDKPeerManager this_arg_conv;
52008         this_arg_conv.inner = untag_ptr(this_arg);
52009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52011         this_arg_conv.is_owned = false;
52012         LDKThreeBytes rgb_ref;
52013         CHECK((*env)->GetArrayLength(env, rgb) == 3);
52014         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
52015         LDKThirtyTwoBytes alias_ref;
52016         CHECK((*env)->GetArrayLength(env, alias) == 32);
52017         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
52018         LDKCVec_SocketAddressZ addresses_constr;
52019         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
52020         if (addresses_constr.datalen > 0)
52021                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52022         else
52023                 addresses_constr.data = NULL;
52024         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
52025         for (size_t p = 0; p < addresses_constr.datalen; p++) {
52026                 int64_t addresses_conv_15 = addresses_vals[p];
52027                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
52028                 CHECK_ACCESS(addresses_conv_15_ptr);
52029                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
52030                 addresses_constr.data[p] = addresses_conv_15_conv;
52031         }
52032         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
52033         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
52034 }
52035
52036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
52037         LDKChannelTypeFeatures channel_type_features_conv;
52038         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52039         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52040         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52041         channel_type_features_conv.is_owned = false;
52042         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
52043         return ret_conv;
52044 }
52045
52046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
52047         LDKChannelTypeFeatures channel_type_features_conv;
52048         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52049         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52050         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52051         channel_type_features_conv.is_owned = false;
52052         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
52053         return ret_conv;
52054 }
52055
52056 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52057         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
52058         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
52059         return ret_conv;
52060 }
52061
52062 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
52063         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
52064         return ret_conv;
52065 }
52066
52067 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
52068         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
52069         return ret_conv;
52070 }
52071
52072 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
52073         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
52074         return ret_conv;
52075 }
52076
52077 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
52078         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
52079         return ret_conv;
52080 }
52081
52082 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
52083         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
52084         return ret_conv;
52085 }
52086
52087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52088         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
52089         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
52090         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
52091         return ret_conv;
52092 }
52093
52094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
52095         LDKWitness witness_ref;
52096         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
52097         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
52098         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
52099         witness_ref.data_is_owned = true;
52100         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
52101         *ret_copy = HTLCClaim_from_witness(witness_ref);
52102         int64_t ret_ref = tag_ptr(ret_copy, true);
52103         return ret_ref;
52104 }
52105
52106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
52107         uint8_t commitment_seed_arr[32];
52108         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
52109         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
52110         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
52111         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52112         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
52113         return ret_arr;
52114 }
52115
52116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
52117         LDKCVec_u8Z to_holder_script_ref;
52118         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
52119         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
52120         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
52121         LDKCVec_u8Z to_counterparty_script_ref;
52122         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
52123         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
52124         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
52125         LDKOutPoint funding_outpoint_conv;
52126         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
52127         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
52128         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
52129         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
52130         LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
52131         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52132         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52133         Transaction_free(ret_var);
52134         return ret_arr;
52135 }
52136
52137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52138         LDKCounterpartyCommitmentSecrets this_obj_conv;
52139         this_obj_conv.inner = untag_ptr(this_obj);
52140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52142         CounterpartyCommitmentSecrets_free(this_obj_conv);
52143 }
52144
52145 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
52146         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
52147         int64_t ret_ref = 0;
52148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52150         return ret_ref;
52151 }
52152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52153         LDKCounterpartyCommitmentSecrets arg_conv;
52154         arg_conv.inner = untag_ptr(arg);
52155         arg_conv.is_owned = ptr_is_owned(arg);
52156         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52157         arg_conv.is_owned = false;
52158         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
52159         return ret_conv;
52160 }
52161
52162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52163         LDKCounterpartyCommitmentSecrets orig_conv;
52164         orig_conv.inner = untag_ptr(orig);
52165         orig_conv.is_owned = ptr_is_owned(orig);
52166         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52167         orig_conv.is_owned = false;
52168         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
52169         int64_t ret_ref = 0;
52170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52172         return ret_ref;
52173 }
52174
52175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
52176         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
52177         int64_t ret_ref = 0;
52178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52180         return ret_ref;
52181 }
52182
52183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
52184         LDKCounterpartyCommitmentSecrets this_arg_conv;
52185         this_arg_conv.inner = untag_ptr(this_arg);
52186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52188         this_arg_conv.is_owned = false;
52189         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
52190         return ret_conv;
52191 }
52192
52193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1provide_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
52194         LDKCounterpartyCommitmentSecrets this_arg_conv;
52195         this_arg_conv.inner = untag_ptr(this_arg);
52196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52198         this_arg_conv.is_owned = false;
52199         LDKThirtyTwoBytes secret_ref;
52200         CHECK((*env)->GetArrayLength(env, secret) == 32);
52201         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
52202         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52203         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
52204         return tag_ptr(ret_conv, true);
52205 }
52206
52207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
52208         LDKCounterpartyCommitmentSecrets this_arg_conv;
52209         this_arg_conv.inner = untag_ptr(this_arg);
52210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52212         this_arg_conv.is_owned = false;
52213         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52214         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
52215         return ret_arr;
52216 }
52217
52218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
52219         LDKCounterpartyCommitmentSecrets obj_conv;
52220         obj_conv.inner = untag_ptr(obj);
52221         obj_conv.is_owned = ptr_is_owned(obj);
52222         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52223         obj_conv.is_owned = false;
52224         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
52225         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52226         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52227         CVec_u8Z_free(ret_var);
52228         return ret_arr;
52229 }
52230
52231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52232         LDKu8slice ser_ref;
52233         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52234         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52235         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
52236         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
52237         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52238         return tag_ptr(ret_conv, true);
52239 }
52240
52241 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
52242         LDKPublicKey per_commitment_point_ref;
52243         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52244         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52245         uint8_t base_secret_arr[32];
52246         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
52247         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
52248         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
52249         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52250         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
52251         return ret_arr;
52252 }
52253
52254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_point) {
52255         LDKPublicKey per_commitment_point_ref;
52256         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52257         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52258         LDKPublicKey base_point_ref;
52259         CHECK((*env)->GetArrayLength(env, base_point) == 33);
52260         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
52261         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52262         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form);
52263         return ret_arr;
52264 }
52265
52266 JNIEXPORT int8_tArray 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) {
52267         uint8_t per_commitment_secret_arr[32];
52268         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
52269         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
52270         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
52271         uint8_t countersignatory_revocation_base_secret_arr[32];
52272         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
52273         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
52274         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
52275         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52276         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
52277         return ret_arr;
52278 }
52279
52280 JNIEXPORT int8_tArray 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) {
52281         LDKPublicKey per_commitment_point_ref;
52282         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52283         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52284         LDKPublicKey countersignatory_revocation_base_point_ref;
52285         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
52286         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
52287         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52288         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form);
52289         return ret_arr;
52290 }
52291
52292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52293         LDKTxCreationKeys this_obj_conv;
52294         this_obj_conv.inner = untag_ptr(this_obj);
52295         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52297         TxCreationKeys_free(this_obj_conv);
52298 }
52299
52300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52301         LDKTxCreationKeys this_ptr_conv;
52302         this_ptr_conv.inner = untag_ptr(this_ptr);
52303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52305         this_ptr_conv.is_owned = false;
52306         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52307         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
52308         return ret_arr;
52309 }
52310
52311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52312         LDKTxCreationKeys this_ptr_conv;
52313         this_ptr_conv.inner = untag_ptr(this_ptr);
52314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52316         this_ptr_conv.is_owned = false;
52317         LDKPublicKey val_ref;
52318         CHECK((*env)->GetArrayLength(env, val) == 33);
52319         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52320         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
52321 }
52322
52323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52324         LDKTxCreationKeys this_ptr_conv;
52325         this_ptr_conv.inner = untag_ptr(this_ptr);
52326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52328         this_ptr_conv.is_owned = false;
52329         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52330         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
52331         return ret_arr;
52332 }
52333
52334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52335         LDKTxCreationKeys this_ptr_conv;
52336         this_ptr_conv.inner = untag_ptr(this_ptr);
52337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52339         this_ptr_conv.is_owned = false;
52340         LDKPublicKey val_ref;
52341         CHECK((*env)->GetArrayLength(env, val) == 33);
52342         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52343         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
52344 }
52345
52346 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52347         LDKTxCreationKeys this_ptr_conv;
52348         this_ptr_conv.inner = untag_ptr(this_ptr);
52349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52351         this_ptr_conv.is_owned = false;
52352         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52353         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
52354         return ret_arr;
52355 }
52356
52357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52358         LDKTxCreationKeys this_ptr_conv;
52359         this_ptr_conv.inner = untag_ptr(this_ptr);
52360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52362         this_ptr_conv.is_owned = false;
52363         LDKPublicKey val_ref;
52364         CHECK((*env)->GetArrayLength(env, val) == 33);
52365         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52366         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
52367 }
52368
52369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52370         LDKTxCreationKeys this_ptr_conv;
52371         this_ptr_conv.inner = untag_ptr(this_ptr);
52372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52374         this_ptr_conv.is_owned = false;
52375         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52376         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
52377         return ret_arr;
52378 }
52379
52380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52381         LDKTxCreationKeys this_ptr_conv;
52382         this_ptr_conv.inner = untag_ptr(this_ptr);
52383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52385         this_ptr_conv.is_owned = false;
52386         LDKPublicKey val_ref;
52387         CHECK((*env)->GetArrayLength(env, val) == 33);
52388         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52389         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
52390 }
52391
52392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52393         LDKTxCreationKeys this_ptr_conv;
52394         this_ptr_conv.inner = untag_ptr(this_ptr);
52395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52397         this_ptr_conv.is_owned = false;
52398         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52399         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
52400         return ret_arr;
52401 }
52402
52403 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) {
52404         LDKTxCreationKeys this_ptr_conv;
52405         this_ptr_conv.inner = untag_ptr(this_ptr);
52406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52408         this_ptr_conv.is_owned = false;
52409         LDKPublicKey val_ref;
52410         CHECK((*env)->GetArrayLength(env, val) == 33);
52411         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52412         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
52413 }
52414
52415 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) {
52416         LDKPublicKey per_commitment_point_arg_ref;
52417         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
52418         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
52419         LDKPublicKey revocation_key_arg_ref;
52420         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
52421         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
52422         LDKPublicKey broadcaster_htlc_key_arg_ref;
52423         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
52424         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
52425         LDKPublicKey countersignatory_htlc_key_arg_ref;
52426         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
52427         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
52428         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
52429         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
52430         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
52431         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);
52432         int64_t ret_ref = 0;
52433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52435         return ret_ref;
52436 }
52437
52438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52439         LDKTxCreationKeys a_conv;
52440         a_conv.inner = untag_ptr(a);
52441         a_conv.is_owned = ptr_is_owned(a);
52442         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52443         a_conv.is_owned = false;
52444         LDKTxCreationKeys b_conv;
52445         b_conv.inner = untag_ptr(b);
52446         b_conv.is_owned = ptr_is_owned(b);
52447         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52448         b_conv.is_owned = false;
52449         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
52450         return ret_conv;
52451 }
52452
52453 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
52454         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
52455         int64_t ret_ref = 0;
52456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52458         return ret_ref;
52459 }
52460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52461         LDKTxCreationKeys arg_conv;
52462         arg_conv.inner = untag_ptr(arg);
52463         arg_conv.is_owned = ptr_is_owned(arg);
52464         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52465         arg_conv.is_owned = false;
52466         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
52467         return ret_conv;
52468 }
52469
52470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52471         LDKTxCreationKeys orig_conv;
52472         orig_conv.inner = untag_ptr(orig);
52473         orig_conv.is_owned = ptr_is_owned(orig);
52474         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52475         orig_conv.is_owned = false;
52476         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
52477         int64_t ret_ref = 0;
52478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52480         return ret_ref;
52481 }
52482
52483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
52484         LDKTxCreationKeys obj_conv;
52485         obj_conv.inner = untag_ptr(obj);
52486         obj_conv.is_owned = ptr_is_owned(obj);
52487         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52488         obj_conv.is_owned = false;
52489         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
52490         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52491         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52492         CVec_u8Z_free(ret_var);
52493         return ret_arr;
52494 }
52495
52496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52497         LDKu8slice ser_ref;
52498         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52499         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52500         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
52501         *ret_conv = TxCreationKeys_read(ser_ref);
52502         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52503         return tag_ptr(ret_conv, true);
52504 }
52505
52506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52507         LDKChannelPublicKeys this_obj_conv;
52508         this_obj_conv.inner = untag_ptr(this_obj);
52509         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52511         ChannelPublicKeys_free(this_obj_conv);
52512 }
52513
52514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
52515         LDKChannelPublicKeys this_ptr_conv;
52516         this_ptr_conv.inner = untag_ptr(this_ptr);
52517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52519         this_ptr_conv.is_owned = false;
52520         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52521         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
52522         return ret_arr;
52523 }
52524
52525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52526         LDKChannelPublicKeys this_ptr_conv;
52527         this_ptr_conv.inner = untag_ptr(this_ptr);
52528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52530         this_ptr_conv.is_owned = false;
52531         LDKPublicKey val_ref;
52532         CHECK((*env)->GetArrayLength(env, val) == 33);
52533         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52534         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
52535 }
52536
52537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52538         LDKChannelPublicKeys this_ptr_conv;
52539         this_ptr_conv.inner = untag_ptr(this_ptr);
52540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52542         this_ptr_conv.is_owned = false;
52543         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52544         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
52545         return ret_arr;
52546 }
52547
52548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52549         LDKChannelPublicKeys this_ptr_conv;
52550         this_ptr_conv.inner = untag_ptr(this_ptr);
52551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52553         this_ptr_conv.is_owned = false;
52554         LDKPublicKey val_ref;
52555         CHECK((*env)->GetArrayLength(env, val) == 33);
52556         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52557         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
52558 }
52559
52560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52561         LDKChannelPublicKeys this_ptr_conv;
52562         this_ptr_conv.inner = untag_ptr(this_ptr);
52563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52565         this_ptr_conv.is_owned = false;
52566         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52567         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
52568         return ret_arr;
52569 }
52570
52571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52572         LDKChannelPublicKeys this_ptr_conv;
52573         this_ptr_conv.inner = untag_ptr(this_ptr);
52574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52576         this_ptr_conv.is_owned = false;
52577         LDKPublicKey val_ref;
52578         CHECK((*env)->GetArrayLength(env, val) == 33);
52579         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52580         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
52581 }
52582
52583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52584         LDKChannelPublicKeys this_ptr_conv;
52585         this_ptr_conv.inner = untag_ptr(this_ptr);
52586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52588         this_ptr_conv.is_owned = false;
52589         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52590         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
52591         return ret_arr;
52592 }
52593
52594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52595         LDKChannelPublicKeys this_ptr_conv;
52596         this_ptr_conv.inner = untag_ptr(this_ptr);
52597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52599         this_ptr_conv.is_owned = false;
52600         LDKPublicKey val_ref;
52601         CHECK((*env)->GetArrayLength(env, val) == 33);
52602         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52603         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
52604 }
52605
52606 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52607         LDKChannelPublicKeys this_ptr_conv;
52608         this_ptr_conv.inner = untag_ptr(this_ptr);
52609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52611         this_ptr_conv.is_owned = false;
52612         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52613         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
52614         return ret_arr;
52615 }
52616
52617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52618         LDKChannelPublicKeys this_ptr_conv;
52619         this_ptr_conv.inner = untag_ptr(this_ptr);
52620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52622         this_ptr_conv.is_owned = false;
52623         LDKPublicKey val_ref;
52624         CHECK((*env)->GetArrayLength(env, val) == 33);
52625         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52626         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
52627 }
52628
52629 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) {
52630         LDKPublicKey funding_pubkey_arg_ref;
52631         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
52632         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
52633         LDKPublicKey revocation_basepoint_arg_ref;
52634         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
52635         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
52636         LDKPublicKey payment_point_arg_ref;
52637         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
52638         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
52639         LDKPublicKey delayed_payment_basepoint_arg_ref;
52640         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
52641         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
52642         LDKPublicKey htlc_basepoint_arg_ref;
52643         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
52644         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
52645         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);
52646         int64_t ret_ref = 0;
52647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52649         return ret_ref;
52650 }
52651
52652 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
52653         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
52654         int64_t ret_ref = 0;
52655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52657         return ret_ref;
52658 }
52659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52660         LDKChannelPublicKeys arg_conv;
52661         arg_conv.inner = untag_ptr(arg);
52662         arg_conv.is_owned = ptr_is_owned(arg);
52663         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52664         arg_conv.is_owned = false;
52665         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
52666         return ret_conv;
52667 }
52668
52669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52670         LDKChannelPublicKeys orig_conv;
52671         orig_conv.inner = untag_ptr(orig);
52672         orig_conv.is_owned = ptr_is_owned(orig);
52673         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52674         orig_conv.is_owned = false;
52675         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
52676         int64_t ret_ref = 0;
52677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52679         return ret_ref;
52680 }
52681
52682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1hash(JNIEnv *env, jclass clz, int64_t o) {
52683         LDKChannelPublicKeys o_conv;
52684         o_conv.inner = untag_ptr(o);
52685         o_conv.is_owned = ptr_is_owned(o);
52686         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52687         o_conv.is_owned = false;
52688         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
52689         return ret_conv;
52690 }
52691
52692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52693         LDKChannelPublicKeys a_conv;
52694         a_conv.inner = untag_ptr(a);
52695         a_conv.is_owned = ptr_is_owned(a);
52696         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52697         a_conv.is_owned = false;
52698         LDKChannelPublicKeys b_conv;
52699         b_conv.inner = untag_ptr(b);
52700         b_conv.is_owned = ptr_is_owned(b);
52701         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52702         b_conv.is_owned = false;
52703         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
52704         return ret_conv;
52705 }
52706
52707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
52708         LDKChannelPublicKeys obj_conv;
52709         obj_conv.inner = untag_ptr(obj);
52710         obj_conv.is_owned = ptr_is_owned(obj);
52711         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52712         obj_conv.is_owned = false;
52713         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
52714         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52715         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52716         CVec_u8Z_free(ret_var);
52717         return ret_arr;
52718 }
52719
52720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52721         LDKu8slice ser_ref;
52722         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52723         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52724         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
52725         *ret_conv = ChannelPublicKeys_read(ser_ref);
52726         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52727         return tag_ptr(ret_conv, true);
52728 }
52729
52730 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) {
52731         LDKPublicKey per_commitment_point_ref;
52732         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52733         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52734         LDKPublicKey broadcaster_delayed_payment_base_ref;
52735         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
52736         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
52737         LDKPublicKey broadcaster_htlc_base_ref;
52738         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
52739         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
52740         LDKPublicKey countersignatory_revocation_base_ref;
52741         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
52742         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
52743         LDKPublicKey countersignatory_htlc_base_ref;
52744         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
52745         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
52746         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
52747         int64_t ret_ref = 0;
52748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52750         return ret_ref;
52751 }
52752
52753 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) {
52754         LDKPublicKey per_commitment_point_ref;
52755         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52756         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52757         LDKChannelPublicKeys broadcaster_keys_conv;
52758         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
52759         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
52760         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
52761         broadcaster_keys_conv.is_owned = false;
52762         LDKChannelPublicKeys countersignatory_keys_conv;
52763         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
52764         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
52765         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
52766         countersignatory_keys_conv.is_owned = false;
52767         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
52768         int64_t ret_ref = 0;
52769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52771         return ret_ref;
52772 }
52773
52774 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) {
52775         LDKPublicKey revocation_key_ref;
52776         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
52777         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
52778         LDKPublicKey broadcaster_delayed_payment_key_ref;
52779         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
52780         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
52781         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
52782         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52783         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52784         CVec_u8Z_free(ret_var);
52785         return ret_arr;
52786 }
52787
52788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1counterparty_1payment_1script(JNIEnv *env, jclass clz, int64_t channel_type_features, int8_tArray payment_key) {
52789         LDKChannelTypeFeatures channel_type_features_conv;
52790         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52791         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52792         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52793         channel_type_features_conv.is_owned = false;
52794         LDKPublicKey payment_key_ref;
52795         CHECK((*env)->GetArrayLength(env, payment_key) == 33);
52796         (*env)->GetByteArrayRegion(env, payment_key, 0, 33, payment_key_ref.compressed_form);
52797         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
52798         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52799         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52800         CVec_u8Z_free(ret_var);
52801         return ret_arr;
52802 }
52803
52804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52805         LDKHTLCOutputInCommitment this_obj_conv;
52806         this_obj_conv.inner = untag_ptr(this_obj);
52807         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52809         HTLCOutputInCommitment_free(this_obj_conv);
52810 }
52811
52812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
52813         LDKHTLCOutputInCommitment this_ptr_conv;
52814         this_ptr_conv.inner = untag_ptr(this_ptr);
52815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52817         this_ptr_conv.is_owned = false;
52818         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
52819         return ret_conv;
52820 }
52821
52822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
52823         LDKHTLCOutputInCommitment this_ptr_conv;
52824         this_ptr_conv.inner = untag_ptr(this_ptr);
52825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52827         this_ptr_conv.is_owned = false;
52828         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
52829 }
52830
52831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
52832         LDKHTLCOutputInCommitment this_ptr_conv;
52833         this_ptr_conv.inner = untag_ptr(this_ptr);
52834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52836         this_ptr_conv.is_owned = false;
52837         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
52838         return ret_conv;
52839 }
52840
52841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52842         LDKHTLCOutputInCommitment this_ptr_conv;
52843         this_ptr_conv.inner = untag_ptr(this_ptr);
52844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52846         this_ptr_conv.is_owned = false;
52847         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
52848 }
52849
52850 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
52851         LDKHTLCOutputInCommitment this_ptr_conv;
52852         this_ptr_conv.inner = untag_ptr(this_ptr);
52853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52855         this_ptr_conv.is_owned = false;
52856         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
52857         return ret_conv;
52858 }
52859
52860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
52861         LDKHTLCOutputInCommitment this_ptr_conv;
52862         this_ptr_conv.inner = untag_ptr(this_ptr);
52863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52865         this_ptr_conv.is_owned = false;
52866         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
52867 }
52868
52869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
52870         LDKHTLCOutputInCommitment this_ptr_conv;
52871         this_ptr_conv.inner = untag_ptr(this_ptr);
52872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52874         this_ptr_conv.is_owned = false;
52875         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52876         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
52877         return ret_arr;
52878 }
52879
52880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52881         LDKHTLCOutputInCommitment this_ptr_conv;
52882         this_ptr_conv.inner = untag_ptr(this_ptr);
52883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52885         this_ptr_conv.is_owned = false;
52886         LDKThirtyTwoBytes val_ref;
52887         CHECK((*env)->GetArrayLength(env, val) == 32);
52888         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52889         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
52890 }
52891
52892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
52893         LDKHTLCOutputInCommitment this_ptr_conv;
52894         this_ptr_conv.inner = untag_ptr(this_ptr);
52895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52897         this_ptr_conv.is_owned = false;
52898         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
52899         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
52900         int64_t ret_ref = tag_ptr(ret_copy, true);
52901         return ret_ref;
52902 }
52903
52904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52905         LDKHTLCOutputInCommitment this_ptr_conv;
52906         this_ptr_conv.inner = untag_ptr(this_ptr);
52907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52909         this_ptr_conv.is_owned = false;
52910         void* val_ptr = untag_ptr(val);
52911         CHECK_ACCESS(val_ptr);
52912         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
52913         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
52914         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
52915 }
52916
52917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1new(JNIEnv *env, jclass clz, jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t transaction_output_index_arg) {
52918         LDKThirtyTwoBytes payment_hash_arg_ref;
52919         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
52920         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
52921         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
52922         CHECK_ACCESS(transaction_output_index_arg_ptr);
52923         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
52924         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
52925         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
52926         int64_t ret_ref = 0;
52927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52929         return ret_ref;
52930 }
52931
52932 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
52933         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
52934         int64_t ret_ref = 0;
52935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52937         return ret_ref;
52938 }
52939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52940         LDKHTLCOutputInCommitment arg_conv;
52941         arg_conv.inner = untag_ptr(arg);
52942         arg_conv.is_owned = ptr_is_owned(arg);
52943         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52944         arg_conv.is_owned = false;
52945         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
52946         return ret_conv;
52947 }
52948
52949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52950         LDKHTLCOutputInCommitment orig_conv;
52951         orig_conv.inner = untag_ptr(orig);
52952         orig_conv.is_owned = ptr_is_owned(orig);
52953         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52954         orig_conv.is_owned = false;
52955         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
52956         int64_t ret_ref = 0;
52957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52959         return ret_ref;
52960 }
52961
52962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52963         LDKHTLCOutputInCommitment a_conv;
52964         a_conv.inner = untag_ptr(a);
52965         a_conv.is_owned = ptr_is_owned(a);
52966         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52967         a_conv.is_owned = false;
52968         LDKHTLCOutputInCommitment b_conv;
52969         b_conv.inner = untag_ptr(b);
52970         b_conv.is_owned = ptr_is_owned(b);
52971         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52972         b_conv.is_owned = false;
52973         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
52974         return ret_conv;
52975 }
52976
52977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
52978         LDKHTLCOutputInCommitment obj_conv;
52979         obj_conv.inner = untag_ptr(obj);
52980         obj_conv.is_owned = ptr_is_owned(obj);
52981         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52982         obj_conv.is_owned = false;
52983         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
52984         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52985         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52986         CVec_u8Z_free(ret_var);
52987         return ret_arr;
52988 }
52989
52990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52991         LDKu8slice ser_ref;
52992         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52993         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52994         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
52995         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
52996         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52997         return tag_ptr(ret_conv, true);
52998 }
52999
53000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t channel_type_features, int64_t keys) {
53001         LDKHTLCOutputInCommitment htlc_conv;
53002         htlc_conv.inner = untag_ptr(htlc);
53003         htlc_conv.is_owned = ptr_is_owned(htlc);
53004         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53005         htlc_conv.is_owned = false;
53006         LDKChannelTypeFeatures channel_type_features_conv;
53007         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53008         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53009         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53010         channel_type_features_conv.is_owned = false;
53011         LDKTxCreationKeys keys_conv;
53012         keys_conv.inner = untag_ptr(keys);
53013         keys_conv.is_owned = ptr_is_owned(keys);
53014         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
53015         keys_conv.is_owned = false;
53016         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
53017         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53018         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53019         CVec_u8Z_free(ret_var);
53020         return ret_arr;
53021 }
53022
53023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
53024         LDKPublicKey broadcaster_ref;
53025         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
53026         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
53027         LDKPublicKey countersignatory_ref;
53028         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
53029         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
53030         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
53031         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53032         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53033         CVec_u8Z_free(ret_var);
53034         return ret_arr;
53035 }
53036
53037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int64_t channel_type_features, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
53038         uint8_t commitment_txid_arr[32];
53039         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
53040         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
53041         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
53042         LDKHTLCOutputInCommitment htlc_conv;
53043         htlc_conv.inner = untag_ptr(htlc);
53044         htlc_conv.is_owned = ptr_is_owned(htlc);
53045         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53046         htlc_conv.is_owned = false;
53047         LDKChannelTypeFeatures channel_type_features_conv;
53048         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53049         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53050         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53051         channel_type_features_conv.is_owned = false;
53052         LDKPublicKey broadcaster_delayed_payment_key_ref;
53053         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
53054         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
53055         LDKPublicKey revocation_key_ref;
53056         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
53057         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
53058         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
53059         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53060         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53061         Transaction_free(ret_var);
53062         return ret_arr;
53063 }
53064
53065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1input_1witness(JNIEnv *env, jclass clz, int8_tArray local_sig, int8_tArray remote_sig, int64_t preimage, int8_tArray redeem_script, int64_t channel_type_features) {
53066         LDKECDSASignature local_sig_ref;
53067         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
53068         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
53069         LDKECDSASignature remote_sig_ref;
53070         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
53071         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
53072         void* preimage_ptr = untag_ptr(preimage);
53073         CHECK_ACCESS(preimage_ptr);
53074         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
53075         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
53076         LDKu8slice redeem_script_ref;
53077         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
53078         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
53079         LDKChannelTypeFeatures channel_type_features_conv;
53080         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53081         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53082         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53083         channel_type_features_conv.is_owned = false;
53084         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
53085         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53086         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53087         Witness_free(ret_var);
53088         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
53089         return ret_arr;
53090 }
53091
53092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
53093         LDKPublicKey payment_point_ref;
53094         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
53095         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
53096         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
53097         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53098         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53099         CVec_u8Z_free(ret_var);
53100         return ret_arr;
53101 }
53102
53103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
53104         LDKPublicKey funding_pubkey_ref;
53105         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
53106         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
53107         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
53108         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53109         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53110         CVec_u8Z_free(ret_var);
53111         return ret_arr;
53112 }
53113
53114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1anchor_1input_1witness(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray funding_sig) {
53115         LDKPublicKey funding_key_ref;
53116         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
53117         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
53118         LDKECDSASignature funding_sig_ref;
53119         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
53120         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
53121         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
53122         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53123         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53124         Witness_free(ret_var);
53125         return ret_arr;
53126 }
53127
53128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53129         LDKChannelTransactionParameters this_obj_conv;
53130         this_obj_conv.inner = untag_ptr(this_obj);
53131         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53133         ChannelTransactionParameters_free(this_obj_conv);
53134 }
53135
53136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
53137         LDKChannelTransactionParameters this_ptr_conv;
53138         this_ptr_conv.inner = untag_ptr(this_ptr);
53139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53141         this_ptr_conv.is_owned = false;
53142         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
53143         int64_t ret_ref = 0;
53144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53146         return ret_ref;
53147 }
53148
53149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53150         LDKChannelTransactionParameters this_ptr_conv;
53151         this_ptr_conv.inner = untag_ptr(this_ptr);
53152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53154         this_ptr_conv.is_owned = false;
53155         LDKChannelPublicKeys val_conv;
53156         val_conv.inner = untag_ptr(val);
53157         val_conv.is_owned = ptr_is_owned(val);
53158         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53159         val_conv = ChannelPublicKeys_clone(&val_conv);
53160         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
53161 }
53162
53163 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
53164         LDKChannelTransactionParameters this_ptr_conv;
53165         this_ptr_conv.inner = untag_ptr(this_ptr);
53166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53168         this_ptr_conv.is_owned = false;
53169         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
53170         return ret_conv;
53171 }
53172
53173 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) {
53174         LDKChannelTransactionParameters this_ptr_conv;
53175         this_ptr_conv.inner = untag_ptr(this_ptr);
53176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53178         this_ptr_conv.is_owned = false;
53179         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
53180 }
53181
53182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
53183         LDKChannelTransactionParameters this_ptr_conv;
53184         this_ptr_conv.inner = untag_ptr(this_ptr);
53185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53187         this_ptr_conv.is_owned = false;
53188         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
53189         return ret_conv;
53190 }
53191
53192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
53193         LDKChannelTransactionParameters this_ptr_conv;
53194         this_ptr_conv.inner = untag_ptr(this_ptr);
53195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53197         this_ptr_conv.is_owned = false;
53198         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
53199 }
53200
53201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
53202         LDKChannelTransactionParameters this_ptr_conv;
53203         this_ptr_conv.inner = untag_ptr(this_ptr);
53204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53206         this_ptr_conv.is_owned = false;
53207         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
53208         int64_t ret_ref = 0;
53209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53211         return ret_ref;
53212 }
53213
53214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53215         LDKChannelTransactionParameters this_ptr_conv;
53216         this_ptr_conv.inner = untag_ptr(this_ptr);
53217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53219         this_ptr_conv.is_owned = false;
53220         LDKCounterpartyChannelTransactionParameters val_conv;
53221         val_conv.inner = untag_ptr(val);
53222         val_conv.is_owned = ptr_is_owned(val);
53223         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53224         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
53225         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
53226 }
53227
53228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53229         LDKChannelTransactionParameters this_ptr_conv;
53230         this_ptr_conv.inner = untag_ptr(this_ptr);
53231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53233         this_ptr_conv.is_owned = false;
53234         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
53235         int64_t ret_ref = 0;
53236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53238         return ret_ref;
53239 }
53240
53241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53242         LDKChannelTransactionParameters this_ptr_conv;
53243         this_ptr_conv.inner = untag_ptr(this_ptr);
53244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53246         this_ptr_conv.is_owned = false;
53247         LDKOutPoint val_conv;
53248         val_conv.inner = untag_ptr(val);
53249         val_conv.is_owned = ptr_is_owned(val);
53250         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53251         val_conv = OutPoint_clone(&val_conv);
53252         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
53253 }
53254
53255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
53256         LDKChannelTransactionParameters this_ptr_conv;
53257         this_ptr_conv.inner = untag_ptr(this_ptr);
53258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53260         this_ptr_conv.is_owned = false;
53261         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
53262         int64_t ret_ref = 0;
53263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53265         return ret_ref;
53266 }
53267
53268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53269         LDKChannelTransactionParameters this_ptr_conv;
53270         this_ptr_conv.inner = untag_ptr(this_ptr);
53271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53273         this_ptr_conv.is_owned = false;
53274         LDKChannelTypeFeatures val_conv;
53275         val_conv.inner = untag_ptr(val);
53276         val_conv.is_owned = ptr_is_owned(val);
53277         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53278         val_conv = ChannelTypeFeatures_clone(&val_conv);
53279         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
53280 }
53281
53282 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, int64_t channel_type_features_arg) {
53283         LDKChannelPublicKeys holder_pubkeys_arg_conv;
53284         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
53285         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
53286         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
53287         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
53288         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
53289         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
53290         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
53291         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
53292         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
53293         LDKOutPoint funding_outpoint_arg_conv;
53294         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
53295         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
53296         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
53297         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
53298         LDKChannelTypeFeatures channel_type_features_arg_conv;
53299         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
53300         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
53301         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
53302         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
53303         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, channel_type_features_arg_conv);
53304         int64_t ret_ref = 0;
53305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53307         return ret_ref;
53308 }
53309
53310 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
53311         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
53312         int64_t ret_ref = 0;
53313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53315         return ret_ref;
53316 }
53317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53318         LDKChannelTransactionParameters arg_conv;
53319         arg_conv.inner = untag_ptr(arg);
53320         arg_conv.is_owned = ptr_is_owned(arg);
53321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53322         arg_conv.is_owned = false;
53323         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
53324         return ret_conv;
53325 }
53326
53327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53328         LDKChannelTransactionParameters orig_conv;
53329         orig_conv.inner = untag_ptr(orig);
53330         orig_conv.is_owned = ptr_is_owned(orig);
53331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53332         orig_conv.is_owned = false;
53333         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
53334         int64_t ret_ref = 0;
53335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53337         return ret_ref;
53338 }
53339
53340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
53341         LDKChannelTransactionParameters o_conv;
53342         o_conv.inner = untag_ptr(o);
53343         o_conv.is_owned = ptr_is_owned(o);
53344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53345         o_conv.is_owned = false;
53346         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
53347         return ret_conv;
53348 }
53349
53350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53351         LDKChannelTransactionParameters a_conv;
53352         a_conv.inner = untag_ptr(a);
53353         a_conv.is_owned = ptr_is_owned(a);
53354         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53355         a_conv.is_owned = false;
53356         LDKChannelTransactionParameters b_conv;
53357         b_conv.inner = untag_ptr(b);
53358         b_conv.is_owned = ptr_is_owned(b);
53359         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53360         b_conv.is_owned = false;
53361         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
53362         return ret_conv;
53363 }
53364
53365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53366         LDKCounterpartyChannelTransactionParameters this_obj_conv;
53367         this_obj_conv.inner = untag_ptr(this_obj);
53368         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53370         CounterpartyChannelTransactionParameters_free(this_obj_conv);
53371 }
53372
53373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
53374         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53375         this_ptr_conv.inner = untag_ptr(this_ptr);
53376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53378         this_ptr_conv.is_owned = false;
53379         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
53380         int64_t ret_ref = 0;
53381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53383         return ret_ref;
53384 }
53385
53386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53387         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53388         this_ptr_conv.inner = untag_ptr(this_ptr);
53389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53391         this_ptr_conv.is_owned = false;
53392         LDKChannelPublicKeys val_conv;
53393         val_conv.inner = untag_ptr(val);
53394         val_conv.is_owned = ptr_is_owned(val);
53395         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53396         val_conv = ChannelPublicKeys_clone(&val_conv);
53397         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
53398 }
53399
53400 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
53401         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53402         this_ptr_conv.inner = untag_ptr(this_ptr);
53403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53405         this_ptr_conv.is_owned = false;
53406         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
53407         return ret_conv;
53408 }
53409
53410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
53411         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
53412         this_ptr_conv.inner = untag_ptr(this_ptr);
53413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53415         this_ptr_conv.is_owned = false;
53416         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
53417 }
53418
53419 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) {
53420         LDKChannelPublicKeys pubkeys_arg_conv;
53421         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
53422         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
53423         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
53424         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
53425         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
53426         int64_t ret_ref = 0;
53427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53429         return ret_ref;
53430 }
53431
53432 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
53433         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
53434         int64_t ret_ref = 0;
53435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53437         return ret_ref;
53438 }
53439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53440         LDKCounterpartyChannelTransactionParameters arg_conv;
53441         arg_conv.inner = untag_ptr(arg);
53442         arg_conv.is_owned = ptr_is_owned(arg);
53443         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53444         arg_conv.is_owned = false;
53445         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
53446         return ret_conv;
53447 }
53448
53449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53450         LDKCounterpartyChannelTransactionParameters orig_conv;
53451         orig_conv.inner = untag_ptr(orig);
53452         orig_conv.is_owned = ptr_is_owned(orig);
53453         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53454         orig_conv.is_owned = false;
53455         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
53456         int64_t ret_ref = 0;
53457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53459         return ret_ref;
53460 }
53461
53462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
53463         LDKCounterpartyChannelTransactionParameters o_conv;
53464         o_conv.inner = untag_ptr(o);
53465         o_conv.is_owned = ptr_is_owned(o);
53466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53467         o_conv.is_owned = false;
53468         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
53469         return ret_conv;
53470 }
53471
53472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53473         LDKCounterpartyChannelTransactionParameters a_conv;
53474         a_conv.inner = untag_ptr(a);
53475         a_conv.is_owned = ptr_is_owned(a);
53476         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53477         a_conv.is_owned = false;
53478         LDKCounterpartyChannelTransactionParameters b_conv;
53479         b_conv.inner = untag_ptr(b);
53480         b_conv.is_owned = ptr_is_owned(b);
53481         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53482         b_conv.is_owned = false;
53483         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
53484         return ret_conv;
53485 }
53486
53487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
53488         LDKChannelTransactionParameters this_arg_conv;
53489         this_arg_conv.inner = untag_ptr(this_arg);
53490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53492         this_arg_conv.is_owned = false;
53493         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
53494         return ret_conv;
53495 }
53496
53497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
53498         LDKChannelTransactionParameters this_arg_conv;
53499         this_arg_conv.inner = untag_ptr(this_arg);
53500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53502         this_arg_conv.is_owned = false;
53503         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
53504         int64_t ret_ref = 0;
53505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53507         return ret_ref;
53508 }
53509
53510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
53511         LDKChannelTransactionParameters this_arg_conv;
53512         this_arg_conv.inner = untag_ptr(this_arg);
53513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53515         this_arg_conv.is_owned = false;
53516         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
53517         int64_t ret_ref = 0;
53518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53520         return ret_ref;
53521 }
53522
53523 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
53524         LDKCounterpartyChannelTransactionParameters obj_conv;
53525         obj_conv.inner = untag_ptr(obj);
53526         obj_conv.is_owned = ptr_is_owned(obj);
53527         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53528         obj_conv.is_owned = false;
53529         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
53530         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53531         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53532         CVec_u8Z_free(ret_var);
53533         return ret_arr;
53534 }
53535
53536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53537         LDKu8slice ser_ref;
53538         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53539         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53540         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
53541         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
53542         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53543         return tag_ptr(ret_conv, true);
53544 }
53545
53546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
53547         LDKChannelTransactionParameters obj_conv;
53548         obj_conv.inner = untag_ptr(obj);
53549         obj_conv.is_owned = ptr_is_owned(obj);
53550         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53551         obj_conv.is_owned = false;
53552         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
53553         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53554         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53555         CVec_u8Z_free(ret_var);
53556         return ret_arr;
53557 }
53558
53559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53560         LDKu8slice ser_ref;
53561         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53562         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53563         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
53564         *ret_conv = ChannelTransactionParameters_read(ser_ref);
53565         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53566         return tag_ptr(ret_conv, true);
53567 }
53568
53569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53570         LDKDirectedChannelTransactionParameters this_obj_conv;
53571         this_obj_conv.inner = untag_ptr(this_obj);
53572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53574         DirectedChannelTransactionParameters_free(this_obj_conv);
53575 }
53576
53577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
53578         LDKDirectedChannelTransactionParameters this_arg_conv;
53579         this_arg_conv.inner = untag_ptr(this_arg);
53580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53582         this_arg_conv.is_owned = false;
53583         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
53584         int64_t ret_ref = 0;
53585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53587         return ret_ref;
53588 }
53589
53590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
53591         LDKDirectedChannelTransactionParameters this_arg_conv;
53592         this_arg_conv.inner = untag_ptr(this_arg);
53593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53595         this_arg_conv.is_owned = false;
53596         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
53597         int64_t ret_ref = 0;
53598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53600         return ret_ref;
53601 }
53602
53603 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
53604         LDKDirectedChannelTransactionParameters this_arg_conv;
53605         this_arg_conv.inner = untag_ptr(this_arg);
53606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53608         this_arg_conv.is_owned = false;
53609         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
53610         return ret_conv;
53611 }
53612
53613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
53614         LDKDirectedChannelTransactionParameters this_arg_conv;
53615         this_arg_conv.inner = untag_ptr(this_arg);
53616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53618         this_arg_conv.is_owned = false;
53619         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
53620         return ret_conv;
53621 }
53622
53623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
53624         LDKDirectedChannelTransactionParameters this_arg_conv;
53625         this_arg_conv.inner = untag_ptr(this_arg);
53626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53628         this_arg_conv.is_owned = false;
53629         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
53630         int64_t ret_ref = 0;
53631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53633         return ret_ref;
53634 }
53635
53636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
53637         LDKDirectedChannelTransactionParameters this_arg_conv;
53638         this_arg_conv.inner = untag_ptr(this_arg);
53639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53641         this_arg_conv.is_owned = false;
53642         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
53643         int64_t ret_ref = 0;
53644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53646         return ret_ref;
53647 }
53648
53649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53650         LDKHolderCommitmentTransaction this_obj_conv;
53651         this_obj_conv.inner = untag_ptr(this_obj);
53652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53654         HolderCommitmentTransaction_free(this_obj_conv);
53655 }
53656
53657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
53658         LDKHolderCommitmentTransaction this_ptr_conv;
53659         this_ptr_conv.inner = untag_ptr(this_ptr);
53660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53662         this_ptr_conv.is_owned = false;
53663         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53664         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
53665         return ret_arr;
53666 }
53667
53668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53669         LDKHolderCommitmentTransaction this_ptr_conv;
53670         this_ptr_conv.inner = untag_ptr(this_ptr);
53671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53673         this_ptr_conv.is_owned = false;
53674         LDKECDSASignature val_ref;
53675         CHECK((*env)->GetArrayLength(env, val) == 64);
53676         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
53677         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
53678 }
53679
53680 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
53681         LDKHolderCommitmentTransaction this_ptr_conv;
53682         this_ptr_conv.inner = untag_ptr(this_ptr);
53683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53685         this_ptr_conv.is_owned = false;
53686         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
53687         jobjectArray ret_arr = NULL;
53688         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
53689         ;
53690         for (size_t i = 0; i < ret_var.datalen; i++) {
53691                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
53692                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
53693                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
53694         }
53695         
53696         FREE(ret_var.data);
53697         return ret_arr;
53698 }
53699
53700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
53701         LDKHolderCommitmentTransaction this_ptr_conv;
53702         this_ptr_conv.inner = untag_ptr(this_ptr);
53703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53705         this_ptr_conv.is_owned = false;
53706         LDKCVec_ECDSASignatureZ val_constr;
53707         val_constr.datalen = (*env)->GetArrayLength(env, val);
53708         if (val_constr.datalen > 0)
53709                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
53710         else
53711                 val_constr.data = NULL;
53712         for (size_t i = 0; i < val_constr.datalen; i++) {
53713                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
53714                 LDKECDSASignature val_conv_8_ref;
53715                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
53716                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
53717                 val_constr.data[i] = val_conv_8_ref;
53718         }
53719         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
53720 }
53721
53722 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
53723         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
53724         int64_t ret_ref = 0;
53725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53727         return ret_ref;
53728 }
53729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53730         LDKHolderCommitmentTransaction arg_conv;
53731         arg_conv.inner = untag_ptr(arg);
53732         arg_conv.is_owned = ptr_is_owned(arg);
53733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53734         arg_conv.is_owned = false;
53735         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
53736         return ret_conv;
53737 }
53738
53739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53740         LDKHolderCommitmentTransaction orig_conv;
53741         orig_conv.inner = untag_ptr(orig);
53742         orig_conv.is_owned = ptr_is_owned(orig);
53743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53744         orig_conv.is_owned = false;
53745         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
53746         int64_t ret_ref = 0;
53747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53749         return ret_ref;
53750 }
53751
53752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
53753         LDKHolderCommitmentTransaction obj_conv;
53754         obj_conv.inner = untag_ptr(obj);
53755         obj_conv.is_owned = ptr_is_owned(obj);
53756         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53757         obj_conv.is_owned = false;
53758         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
53759         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53760         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53761         CVec_u8Z_free(ret_var);
53762         return ret_arr;
53763 }
53764
53765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53766         LDKu8slice ser_ref;
53767         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53768         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53769         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
53770         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
53771         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53772         return tag_ptr(ret_conv, true);
53773 }
53774
53775 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) {
53776         LDKCommitmentTransaction commitment_tx_conv;
53777         commitment_tx_conv.inner = untag_ptr(commitment_tx);
53778         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
53779         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
53780         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
53781         LDKECDSASignature counterparty_sig_ref;
53782         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
53783         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
53784         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
53785         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
53786         if (counterparty_htlc_sigs_constr.datalen > 0)
53787                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
53788         else
53789                 counterparty_htlc_sigs_constr.data = NULL;
53790         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
53791                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
53792                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
53793                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
53794                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
53795                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
53796         }
53797         LDKPublicKey holder_funding_key_ref;
53798         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
53799         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
53800         LDKPublicKey counterparty_funding_key_ref;
53801         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
53802         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
53803         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
53804         int64_t ret_ref = 0;
53805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53807         return ret_ref;
53808 }
53809
53810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53811         LDKBuiltCommitmentTransaction this_obj_conv;
53812         this_obj_conv.inner = untag_ptr(this_obj);
53813         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53815         BuiltCommitmentTransaction_free(this_obj_conv);
53816 }
53817
53818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
53819         LDKBuiltCommitmentTransaction this_ptr_conv;
53820         this_ptr_conv.inner = untag_ptr(this_ptr);
53821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53823         this_ptr_conv.is_owned = false;
53824         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
53825         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53826         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53827         Transaction_free(ret_var);
53828         return ret_arr;
53829 }
53830
53831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53832         LDKBuiltCommitmentTransaction this_ptr_conv;
53833         this_ptr_conv.inner = untag_ptr(this_ptr);
53834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53836         this_ptr_conv.is_owned = false;
53837         LDKTransaction val_ref;
53838         val_ref.datalen = (*env)->GetArrayLength(env, val);
53839         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
53840         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
53841         val_ref.data_is_owned = true;
53842         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
53843 }
53844
53845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
53846         LDKBuiltCommitmentTransaction this_ptr_conv;
53847         this_ptr_conv.inner = untag_ptr(this_ptr);
53848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53850         this_ptr_conv.is_owned = false;
53851         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53852         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
53853         return ret_arr;
53854 }
53855
53856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53857         LDKBuiltCommitmentTransaction this_ptr_conv;
53858         this_ptr_conv.inner = untag_ptr(this_ptr);
53859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53861         this_ptr_conv.is_owned = false;
53862         LDKThirtyTwoBytes val_ref;
53863         CHECK((*env)->GetArrayLength(env, val) == 32);
53864         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53865         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
53866 }
53867
53868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
53869         LDKTransaction transaction_arg_ref;
53870         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
53871         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
53872         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
53873         transaction_arg_ref.data_is_owned = true;
53874         LDKThirtyTwoBytes txid_arg_ref;
53875         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
53876         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
53877         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
53878         int64_t ret_ref = 0;
53879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53881         return ret_ref;
53882 }
53883
53884 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
53885         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
53886         int64_t ret_ref = 0;
53887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53889         return ret_ref;
53890 }
53891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53892         LDKBuiltCommitmentTransaction arg_conv;
53893         arg_conv.inner = untag_ptr(arg);
53894         arg_conv.is_owned = ptr_is_owned(arg);
53895         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53896         arg_conv.is_owned = false;
53897         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
53898         return ret_conv;
53899 }
53900
53901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53902         LDKBuiltCommitmentTransaction orig_conv;
53903         orig_conv.inner = untag_ptr(orig);
53904         orig_conv.is_owned = ptr_is_owned(orig);
53905         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53906         orig_conv.is_owned = false;
53907         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
53908         int64_t ret_ref = 0;
53909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53911         return ret_ref;
53912 }
53913
53914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
53915         LDKBuiltCommitmentTransaction obj_conv;
53916         obj_conv.inner = untag_ptr(obj);
53917         obj_conv.is_owned = ptr_is_owned(obj);
53918         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53919         obj_conv.is_owned = false;
53920         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
53921         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53922         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53923         CVec_u8Z_free(ret_var);
53924         return ret_arr;
53925 }
53926
53927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53928         LDKu8slice ser_ref;
53929         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53930         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53931         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
53932         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
53933         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53934         return tag_ptr(ret_conv, true);
53935 }
53936
53937 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) {
53938         LDKBuiltCommitmentTransaction this_arg_conv;
53939         this_arg_conv.inner = untag_ptr(this_arg);
53940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53942         this_arg_conv.is_owned = false;
53943         LDKu8slice funding_redeemscript_ref;
53944         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
53945         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
53946         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53947         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
53948         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
53949         return ret_arr;
53950 }
53951
53952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
53953         LDKBuiltCommitmentTransaction this_arg_conv;
53954         this_arg_conv.inner = untag_ptr(this_arg);
53955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53957         this_arg_conv.is_owned = false;
53958         uint8_t funding_key_arr[32];
53959         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
53960         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
53961         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
53962         LDKu8slice funding_redeemscript_ref;
53963         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
53964         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
53965         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53966         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
53967         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
53968         return ret_arr;
53969 }
53970
53971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis, int64_t entropy_source) {
53972         LDKBuiltCommitmentTransaction this_arg_conv;
53973         this_arg_conv.inner = untag_ptr(this_arg);
53974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53976         this_arg_conv.is_owned = false;
53977         uint8_t funding_key_arr[32];
53978         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
53979         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
53980         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
53981         LDKu8slice funding_redeemscript_ref;
53982         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
53983         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
53984         void* entropy_source_ptr = untag_ptr(entropy_source);
53985         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
53986         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
53987         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53988         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign_holder_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis, entropy_source_conv).compact_form);
53989         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
53990         return ret_arr;
53991 }
53992
53993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53994         LDKClosingTransaction this_obj_conv;
53995         this_obj_conv.inner = untag_ptr(this_obj);
53996         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53998         ClosingTransaction_free(this_obj_conv);
53999 }
54000
54001 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
54002         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
54003         int64_t ret_ref = 0;
54004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54006         return ret_ref;
54007 }
54008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54009         LDKClosingTransaction arg_conv;
54010         arg_conv.inner = untag_ptr(arg);
54011         arg_conv.is_owned = ptr_is_owned(arg);
54012         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54013         arg_conv.is_owned = false;
54014         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
54015         return ret_conv;
54016 }
54017
54018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54019         LDKClosingTransaction orig_conv;
54020         orig_conv.inner = untag_ptr(orig);
54021         orig_conv.is_owned = ptr_is_owned(orig);
54022         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54023         orig_conv.is_owned = false;
54024         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
54025         int64_t ret_ref = 0;
54026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54028         return ret_ref;
54029 }
54030
54031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
54032         LDKClosingTransaction o_conv;
54033         o_conv.inner = untag_ptr(o);
54034         o_conv.is_owned = ptr_is_owned(o);
54035         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54036         o_conv.is_owned = false;
54037         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
54038         return ret_conv;
54039 }
54040
54041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54042         LDKClosingTransaction a_conv;
54043         a_conv.inner = untag_ptr(a);
54044         a_conv.is_owned = ptr_is_owned(a);
54045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54046         a_conv.is_owned = false;
54047         LDKClosingTransaction b_conv;
54048         b_conv.inner = untag_ptr(b);
54049         b_conv.is_owned = ptr_is_owned(b);
54050         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54051         b_conv.is_owned = false;
54052         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
54053         return ret_conv;
54054 }
54055
54056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
54057         LDKCVec_u8Z to_holder_script_ref;
54058         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
54059         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
54060         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
54061         LDKCVec_u8Z to_counterparty_script_ref;
54062         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
54063         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
54064         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
54065         LDKOutPoint funding_outpoint_conv;
54066         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54067         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54068         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54069         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54070         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
54071         int64_t ret_ref = 0;
54072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54074         return ret_ref;
54075 }
54076
54077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
54078         LDKClosingTransaction this_arg_conv;
54079         this_arg_conv.inner = untag_ptr(this_arg);
54080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54082         this_arg_conv.is_owned = false;
54083         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
54084         int64_t ret_ref = 0;
54085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54087         return ret_ref;
54088 }
54089
54090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
54091         LDKClosingTransaction this_arg_conv;
54092         this_arg_conv.inner = untag_ptr(this_arg);
54093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54095         this_arg_conv.is_owned = false;
54096         LDKOutPoint funding_outpoint_conv;
54097         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54098         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54099         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54100         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54101         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
54102         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
54103         return tag_ptr(ret_conv, true);
54104 }
54105
54106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54107         LDKClosingTransaction this_arg_conv;
54108         this_arg_conv.inner = untag_ptr(this_arg);
54109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54111         this_arg_conv.is_owned = false;
54112         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
54113         return ret_conv;
54114 }
54115
54116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54117         LDKClosingTransaction this_arg_conv;
54118         this_arg_conv.inner = untag_ptr(this_arg);
54119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54121         this_arg_conv.is_owned = false;
54122         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
54123         return ret_conv;
54124 }
54125
54126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
54127         LDKClosingTransaction this_arg_conv;
54128         this_arg_conv.inner = untag_ptr(this_arg);
54129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54131         this_arg_conv.is_owned = false;
54132         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
54133         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54134         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54135         return ret_arr;
54136 }
54137
54138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
54139         LDKClosingTransaction this_arg_conv;
54140         this_arg_conv.inner = untag_ptr(this_arg);
54141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54143         this_arg_conv.is_owned = false;
54144         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
54145         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54146         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54147         return ret_arr;
54148 }
54149
54150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54151         LDKTrustedClosingTransaction this_obj_conv;
54152         this_obj_conv.inner = untag_ptr(this_obj);
54153         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54155         TrustedClosingTransaction_free(this_obj_conv);
54156 }
54157
54158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
54159         LDKTrustedClosingTransaction this_arg_conv;
54160         this_arg_conv.inner = untag_ptr(this_arg);
54161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54163         this_arg_conv.is_owned = false;
54164         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
54165         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54166         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54167         Transaction_free(ret_var);
54168         return ret_arr;
54169 }
54170
54171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
54172         LDKTrustedClosingTransaction this_arg_conv;
54173         this_arg_conv.inner = untag_ptr(this_arg);
54174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54176         this_arg_conv.is_owned = false;
54177         LDKu8slice funding_redeemscript_ref;
54178         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54179         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54180         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54181         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
54182         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54183         return ret_arr;
54184 }
54185
54186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
54187         LDKTrustedClosingTransaction this_arg_conv;
54188         this_arg_conv.inner = untag_ptr(this_arg);
54189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54191         this_arg_conv.is_owned = false;
54192         uint8_t funding_key_arr[32];
54193         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
54194         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
54195         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54196         LDKu8slice funding_redeemscript_ref;
54197         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54198         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54199         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54200         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
54201         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54202         return ret_arr;
54203 }
54204
54205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54206         LDKCommitmentTransaction this_obj_conv;
54207         this_obj_conv.inner = untag_ptr(this_obj);
54208         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54210         CommitmentTransaction_free(this_obj_conv);
54211 }
54212
54213 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
54214         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
54215         int64_t ret_ref = 0;
54216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54218         return ret_ref;
54219 }
54220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54221         LDKCommitmentTransaction arg_conv;
54222         arg_conv.inner = untag_ptr(arg);
54223         arg_conv.is_owned = ptr_is_owned(arg);
54224         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54225         arg_conv.is_owned = false;
54226         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
54227         return ret_conv;
54228 }
54229
54230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54231         LDKCommitmentTransaction orig_conv;
54232         orig_conv.inner = untag_ptr(orig);
54233         orig_conv.is_owned = ptr_is_owned(orig);
54234         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54235         orig_conv.is_owned = false;
54236         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
54237         int64_t ret_ref = 0;
54238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54240         return ret_ref;
54241 }
54242
54243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
54244         LDKCommitmentTransaction obj_conv;
54245         obj_conv.inner = untag_ptr(obj);
54246         obj_conv.is_owned = ptr_is_owned(obj);
54247         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54248         obj_conv.is_owned = false;
54249         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
54250         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54251         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54252         CVec_u8Z_free(ret_var);
54253         return ret_arr;
54254 }
54255
54256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54257         LDKu8slice ser_ref;
54258         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54259         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54260         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
54261         *ret_conv = CommitmentTransaction_read(ser_ref);
54262         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54263         return tag_ptr(ret_conv, true);
54264 }
54265
54266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
54267         LDKCommitmentTransaction this_arg_conv;
54268         this_arg_conv.inner = untag_ptr(this_arg);
54269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54271         this_arg_conv.is_owned = false;
54272         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
54273         return ret_conv;
54274 }
54275
54276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54277         LDKCommitmentTransaction this_arg_conv;
54278         this_arg_conv.inner = untag_ptr(this_arg);
54279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54281         this_arg_conv.is_owned = false;
54282         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
54283         return ret_conv;
54284 }
54285
54286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54287         LDKCommitmentTransaction this_arg_conv;
54288         this_arg_conv.inner = untag_ptr(this_arg);
54289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54291         this_arg_conv.is_owned = false;
54292         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
54293         return ret_conv;
54294 }
54295
54296 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
54297         LDKCommitmentTransaction this_arg_conv;
54298         this_arg_conv.inner = untag_ptr(this_arg);
54299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54301         this_arg_conv.is_owned = false;
54302         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
54303         return ret_conv;
54304 }
54305
54306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
54307         LDKCommitmentTransaction this_arg_conv;
54308         this_arg_conv.inner = untag_ptr(this_arg);
54309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54311         this_arg_conv.is_owned = false;
54312         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
54313         int64_t ret_ref = 0;
54314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54316         return ret_ref;
54317 }
54318
54319 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) {
54320         LDKCommitmentTransaction this_arg_conv;
54321         this_arg_conv.inner = untag_ptr(this_arg);
54322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54324         this_arg_conv.is_owned = false;
54325         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54326         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54327         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54328         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54329         channel_parameters_conv.is_owned = false;
54330         LDKChannelPublicKeys broadcaster_keys_conv;
54331         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
54332         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
54333         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
54334         broadcaster_keys_conv.is_owned = false;
54335         LDKChannelPublicKeys countersignatory_keys_conv;
54336         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
54337         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
54338         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
54339         countersignatory_keys_conv.is_owned = false;
54340         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
54341         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
54342         return tag_ptr(ret_conv, true);
54343 }
54344
54345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54346         LDKTrustedCommitmentTransaction this_obj_conv;
54347         this_obj_conv.inner = untag_ptr(this_obj);
54348         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54350         TrustedCommitmentTransaction_free(this_obj_conv);
54351 }
54352
54353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
54354         LDKTrustedCommitmentTransaction this_arg_conv;
54355         this_arg_conv.inner = untag_ptr(this_arg);
54356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54358         this_arg_conv.is_owned = false;
54359         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54360         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
54361         return ret_arr;
54362 }
54363
54364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
54365         LDKTrustedCommitmentTransaction this_arg_conv;
54366         this_arg_conv.inner = untag_ptr(this_arg);
54367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54369         this_arg_conv.is_owned = false;
54370         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
54371         int64_t ret_ref = 0;
54372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54374         return ret_ref;
54375 }
54376
54377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
54378         LDKTrustedCommitmentTransaction this_arg_conv;
54379         this_arg_conv.inner = untag_ptr(this_arg);
54380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54382         this_arg_conv.is_owned = false;
54383         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
54384         int64_t ret_ref = 0;
54385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54387         return ret_ref;
54388 }
54389
54390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
54391         LDKTrustedCommitmentTransaction this_arg_conv;
54392         this_arg_conv.inner = untag_ptr(this_arg);
54393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54395         this_arg_conv.is_owned = false;
54396         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
54397         int64_t ret_ref = 0;
54398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54400         return ret_ref;
54401 }
54402
54403 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, int64_t entropy_source) {
54404         LDKTrustedCommitmentTransaction this_arg_conv;
54405         this_arg_conv.inner = untag_ptr(this_arg);
54406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54408         this_arg_conv.is_owned = false;
54409         uint8_t htlc_base_key_arr[32];
54410         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
54411         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
54412         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
54413         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54414         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54415         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54416         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54417         channel_parameters_conv.is_owned = false;
54418         void* entropy_source_ptr = untag_ptr(entropy_source);
54419         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54420         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54421         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
54422         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
54423         return tag_ptr(ret_conv, true);
54424 }
54425
54426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1revokeable_1output_1index(JNIEnv *env, jclass clz, int64_t this_arg) {
54427         LDKTrustedCommitmentTransaction this_arg_conv;
54428         this_arg_conv.inner = untag_ptr(this_arg);
54429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54431         this_arg_conv.is_owned = false;
54432         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
54433         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
54434         int64_t ret_ref = tag_ptr(ret_copy, true);
54435         return ret_ref;
54436 }
54437
54438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1build_1to_1local_1justice_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int64_t feerate_per_kw, int8_tArray destination_script) {
54439         LDKTrustedCommitmentTransaction this_arg_conv;
54440         this_arg_conv.inner = untag_ptr(this_arg);
54441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54443         this_arg_conv.is_owned = false;
54444         LDKCVec_u8Z destination_script_ref;
54445         destination_script_ref.datalen = (*env)->GetArrayLength(env, destination_script);
54446         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
54447         (*env)->GetByteArrayRegion(env, destination_script, 0, destination_script_ref.datalen, destination_script_ref.data);
54448         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
54449         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
54450         return tag_ptr(ret_conv, true);
54451 }
54452
54453 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) {
54454         LDKPublicKey broadcaster_payment_basepoint_ref;
54455         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
54456         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
54457         LDKPublicKey countersignatory_payment_basepoint_ref;
54458         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
54459         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
54460         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
54461         return ret_conv;
54462 }
54463
54464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54465         LDKInitFeatures a_conv;
54466         a_conv.inner = untag_ptr(a);
54467         a_conv.is_owned = ptr_is_owned(a);
54468         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54469         a_conv.is_owned = false;
54470         LDKInitFeatures b_conv;
54471         b_conv.inner = untag_ptr(b);
54472         b_conv.is_owned = ptr_is_owned(b);
54473         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54474         b_conv.is_owned = false;
54475         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
54476         return ret_conv;
54477 }
54478
54479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54480         LDKNodeFeatures a_conv;
54481         a_conv.inner = untag_ptr(a);
54482         a_conv.is_owned = ptr_is_owned(a);
54483         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54484         a_conv.is_owned = false;
54485         LDKNodeFeatures b_conv;
54486         b_conv.inner = untag_ptr(b);
54487         b_conv.is_owned = ptr_is_owned(b);
54488         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54489         b_conv.is_owned = false;
54490         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
54491         return ret_conv;
54492 }
54493
54494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54495         LDKChannelFeatures a_conv;
54496         a_conv.inner = untag_ptr(a);
54497         a_conv.is_owned = ptr_is_owned(a);
54498         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54499         a_conv.is_owned = false;
54500         LDKChannelFeatures b_conv;
54501         b_conv.inner = untag_ptr(b);
54502         b_conv.is_owned = ptr_is_owned(b);
54503         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54504         b_conv.is_owned = false;
54505         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
54506         return ret_conv;
54507 }
54508
54509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54510         LDKBolt11InvoiceFeatures a_conv;
54511         a_conv.inner = untag_ptr(a);
54512         a_conv.is_owned = ptr_is_owned(a);
54513         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54514         a_conv.is_owned = false;
54515         LDKBolt11InvoiceFeatures b_conv;
54516         b_conv.inner = untag_ptr(b);
54517         b_conv.is_owned = ptr_is_owned(b);
54518         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54519         b_conv.is_owned = false;
54520         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
54521         return ret_conv;
54522 }
54523
54524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54525         LDKOfferFeatures a_conv;
54526         a_conv.inner = untag_ptr(a);
54527         a_conv.is_owned = ptr_is_owned(a);
54528         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54529         a_conv.is_owned = false;
54530         LDKOfferFeatures b_conv;
54531         b_conv.inner = untag_ptr(b);
54532         b_conv.is_owned = ptr_is_owned(b);
54533         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54534         b_conv.is_owned = false;
54535         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
54536         return ret_conv;
54537 }
54538
54539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54540         LDKInvoiceRequestFeatures a_conv;
54541         a_conv.inner = untag_ptr(a);
54542         a_conv.is_owned = ptr_is_owned(a);
54543         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54544         a_conv.is_owned = false;
54545         LDKInvoiceRequestFeatures b_conv;
54546         b_conv.inner = untag_ptr(b);
54547         b_conv.is_owned = ptr_is_owned(b);
54548         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54549         b_conv.is_owned = false;
54550         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
54551         return ret_conv;
54552 }
54553
54554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54555         LDKBolt12InvoiceFeatures a_conv;
54556         a_conv.inner = untag_ptr(a);
54557         a_conv.is_owned = ptr_is_owned(a);
54558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54559         a_conv.is_owned = false;
54560         LDKBolt12InvoiceFeatures b_conv;
54561         b_conv.inner = untag_ptr(b);
54562         b_conv.is_owned = ptr_is_owned(b);
54563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54564         b_conv.is_owned = false;
54565         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
54566         return ret_conv;
54567 }
54568
54569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54570         LDKBlindedHopFeatures a_conv;
54571         a_conv.inner = untag_ptr(a);
54572         a_conv.is_owned = ptr_is_owned(a);
54573         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54574         a_conv.is_owned = false;
54575         LDKBlindedHopFeatures b_conv;
54576         b_conv.inner = untag_ptr(b);
54577         b_conv.is_owned = ptr_is_owned(b);
54578         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54579         b_conv.is_owned = false;
54580         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
54581         return ret_conv;
54582 }
54583
54584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54585         LDKChannelTypeFeatures a_conv;
54586         a_conv.inner = untag_ptr(a);
54587         a_conv.is_owned = ptr_is_owned(a);
54588         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54589         a_conv.is_owned = false;
54590         LDKChannelTypeFeatures b_conv;
54591         b_conv.inner = untag_ptr(b);
54592         b_conv.is_owned = ptr_is_owned(b);
54593         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54594         b_conv.is_owned = false;
54595         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
54596         return ret_conv;
54597 }
54598
54599 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
54600         LDKInitFeatures ret_var = InitFeatures_clone(arg);
54601         int64_t ret_ref = 0;
54602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54604         return ret_ref;
54605 }
54606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54607         LDKInitFeatures arg_conv;
54608         arg_conv.inner = untag_ptr(arg);
54609         arg_conv.is_owned = ptr_is_owned(arg);
54610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54611         arg_conv.is_owned = false;
54612         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
54613         return ret_conv;
54614 }
54615
54616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54617         LDKInitFeatures orig_conv;
54618         orig_conv.inner = untag_ptr(orig);
54619         orig_conv.is_owned = ptr_is_owned(orig);
54620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54621         orig_conv.is_owned = false;
54622         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
54623         int64_t ret_ref = 0;
54624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54626         return ret_ref;
54627 }
54628
54629 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
54630         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
54631         int64_t ret_ref = 0;
54632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54634         return ret_ref;
54635 }
54636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54637         LDKNodeFeatures arg_conv;
54638         arg_conv.inner = untag_ptr(arg);
54639         arg_conv.is_owned = ptr_is_owned(arg);
54640         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54641         arg_conv.is_owned = false;
54642         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
54643         return ret_conv;
54644 }
54645
54646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54647         LDKNodeFeatures orig_conv;
54648         orig_conv.inner = untag_ptr(orig);
54649         orig_conv.is_owned = ptr_is_owned(orig);
54650         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54651         orig_conv.is_owned = false;
54652         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
54653         int64_t ret_ref = 0;
54654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54656         return ret_ref;
54657 }
54658
54659 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
54660         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
54661         int64_t ret_ref = 0;
54662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54664         return ret_ref;
54665 }
54666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54667         LDKChannelFeatures arg_conv;
54668         arg_conv.inner = untag_ptr(arg);
54669         arg_conv.is_owned = ptr_is_owned(arg);
54670         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54671         arg_conv.is_owned = false;
54672         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
54673         return ret_conv;
54674 }
54675
54676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54677         LDKChannelFeatures orig_conv;
54678         orig_conv.inner = untag_ptr(orig);
54679         orig_conv.is_owned = ptr_is_owned(orig);
54680         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54681         orig_conv.is_owned = false;
54682         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
54683         int64_t ret_ref = 0;
54684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54686         return ret_ref;
54687 }
54688
54689 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
54690         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
54691         int64_t ret_ref = 0;
54692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54694         return ret_ref;
54695 }
54696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54697         LDKBolt11InvoiceFeatures arg_conv;
54698         arg_conv.inner = untag_ptr(arg);
54699         arg_conv.is_owned = ptr_is_owned(arg);
54700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54701         arg_conv.is_owned = false;
54702         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
54703         return ret_conv;
54704 }
54705
54706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54707         LDKBolt11InvoiceFeatures orig_conv;
54708         orig_conv.inner = untag_ptr(orig);
54709         orig_conv.is_owned = ptr_is_owned(orig);
54710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54711         orig_conv.is_owned = false;
54712         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
54713         int64_t ret_ref = 0;
54714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54716         return ret_ref;
54717 }
54718
54719 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
54720         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
54721         int64_t ret_ref = 0;
54722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54724         return ret_ref;
54725 }
54726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54727         LDKOfferFeatures arg_conv;
54728         arg_conv.inner = untag_ptr(arg);
54729         arg_conv.is_owned = ptr_is_owned(arg);
54730         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54731         arg_conv.is_owned = false;
54732         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
54733         return ret_conv;
54734 }
54735
54736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54737         LDKOfferFeatures orig_conv;
54738         orig_conv.inner = untag_ptr(orig);
54739         orig_conv.is_owned = ptr_is_owned(orig);
54740         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54741         orig_conv.is_owned = false;
54742         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
54743         int64_t ret_ref = 0;
54744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54746         return ret_ref;
54747 }
54748
54749 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
54750         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
54751         int64_t ret_ref = 0;
54752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54754         return ret_ref;
54755 }
54756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54757         LDKInvoiceRequestFeatures arg_conv;
54758         arg_conv.inner = untag_ptr(arg);
54759         arg_conv.is_owned = ptr_is_owned(arg);
54760         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54761         arg_conv.is_owned = false;
54762         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
54763         return ret_conv;
54764 }
54765
54766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54767         LDKInvoiceRequestFeatures orig_conv;
54768         orig_conv.inner = untag_ptr(orig);
54769         orig_conv.is_owned = ptr_is_owned(orig);
54770         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54771         orig_conv.is_owned = false;
54772         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
54773         int64_t ret_ref = 0;
54774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54776         return ret_ref;
54777 }
54778
54779 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
54780         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
54781         int64_t ret_ref = 0;
54782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54784         return ret_ref;
54785 }
54786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54787         LDKBolt12InvoiceFeatures arg_conv;
54788         arg_conv.inner = untag_ptr(arg);
54789         arg_conv.is_owned = ptr_is_owned(arg);
54790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54791         arg_conv.is_owned = false;
54792         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
54793         return ret_conv;
54794 }
54795
54796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54797         LDKBolt12InvoiceFeatures orig_conv;
54798         orig_conv.inner = untag_ptr(orig);
54799         orig_conv.is_owned = ptr_is_owned(orig);
54800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54801         orig_conv.is_owned = false;
54802         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
54803         int64_t ret_ref = 0;
54804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54806         return ret_ref;
54807 }
54808
54809 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
54810         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
54811         int64_t ret_ref = 0;
54812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54814         return ret_ref;
54815 }
54816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54817         LDKBlindedHopFeatures arg_conv;
54818         arg_conv.inner = untag_ptr(arg);
54819         arg_conv.is_owned = ptr_is_owned(arg);
54820         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54821         arg_conv.is_owned = false;
54822         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
54823         return ret_conv;
54824 }
54825
54826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54827         LDKBlindedHopFeatures orig_conv;
54828         orig_conv.inner = untag_ptr(orig);
54829         orig_conv.is_owned = ptr_is_owned(orig);
54830         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54831         orig_conv.is_owned = false;
54832         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
54833         int64_t ret_ref = 0;
54834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54836         return ret_ref;
54837 }
54838
54839 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
54840         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
54841         int64_t ret_ref = 0;
54842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54844         return ret_ref;
54845 }
54846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54847         LDKChannelTypeFeatures arg_conv;
54848         arg_conv.inner = untag_ptr(arg);
54849         arg_conv.is_owned = ptr_is_owned(arg);
54850         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54851         arg_conv.is_owned = false;
54852         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
54853         return ret_conv;
54854 }
54855
54856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54857         LDKChannelTypeFeatures orig_conv;
54858         orig_conv.inner = untag_ptr(orig);
54859         orig_conv.is_owned = ptr_is_owned(orig);
54860         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54861         orig_conv.is_owned = false;
54862         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
54863         int64_t ret_ref = 0;
54864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54866         return ret_ref;
54867 }
54868
54869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54870         LDKInitFeatures this_obj_conv;
54871         this_obj_conv.inner = untag_ptr(this_obj);
54872         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54874         InitFeatures_free(this_obj_conv);
54875 }
54876
54877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54878         LDKNodeFeatures this_obj_conv;
54879         this_obj_conv.inner = untag_ptr(this_obj);
54880         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54882         NodeFeatures_free(this_obj_conv);
54883 }
54884
54885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54886         LDKChannelFeatures this_obj_conv;
54887         this_obj_conv.inner = untag_ptr(this_obj);
54888         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54890         ChannelFeatures_free(this_obj_conv);
54891 }
54892
54893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54894         LDKBolt11InvoiceFeatures this_obj_conv;
54895         this_obj_conv.inner = untag_ptr(this_obj);
54896         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54898         Bolt11InvoiceFeatures_free(this_obj_conv);
54899 }
54900
54901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54902         LDKOfferFeatures this_obj_conv;
54903         this_obj_conv.inner = untag_ptr(this_obj);
54904         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54906         OfferFeatures_free(this_obj_conv);
54907 }
54908
54909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54910         LDKInvoiceRequestFeatures this_obj_conv;
54911         this_obj_conv.inner = untag_ptr(this_obj);
54912         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54914         InvoiceRequestFeatures_free(this_obj_conv);
54915 }
54916
54917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54918         LDKBolt12InvoiceFeatures this_obj_conv;
54919         this_obj_conv.inner = untag_ptr(this_obj);
54920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54922         Bolt12InvoiceFeatures_free(this_obj_conv);
54923 }
54924
54925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54926         LDKBlindedHopFeatures this_obj_conv;
54927         this_obj_conv.inner = untag_ptr(this_obj);
54928         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54930         BlindedHopFeatures_free(this_obj_conv);
54931 }
54932
54933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54934         LDKChannelTypeFeatures this_obj_conv;
54935         this_obj_conv.inner = untag_ptr(this_obj);
54936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54938         ChannelTypeFeatures_free(this_obj_conv);
54939 }
54940
54941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
54942         LDKInitFeatures ret_var = InitFeatures_empty();
54943         int64_t ret_ref = 0;
54944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54946         return ret_ref;
54947 }
54948
54949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
54950         LDKInitFeatures this_arg_conv;
54951         this_arg_conv.inner = untag_ptr(this_arg);
54952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54954         this_arg_conv.is_owned = false;
54955         LDKInitFeatures other_conv;
54956         other_conv.inner = untag_ptr(other);
54957         other_conv.is_owned = ptr_is_owned(other);
54958         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
54959         other_conv.is_owned = false;
54960         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
54961         return ret_conv;
54962 }
54963
54964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
54965         LDKInitFeatures this_arg_conv;
54966         this_arg_conv.inner = untag_ptr(this_arg);
54967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54969         this_arg_conv.is_owned = false;
54970         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
54971         return ret_conv;
54972 }
54973
54974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
54975         LDKInitFeatures this_arg_conv;
54976         this_arg_conv.inner = untag_ptr(this_arg);
54977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54979         this_arg_conv.is_owned = false;
54980         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
54981         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
54982         return tag_ptr(ret_conv, true);
54983 }
54984
54985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
54986         LDKInitFeatures this_arg_conv;
54987         this_arg_conv.inner = untag_ptr(this_arg);
54988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54990         this_arg_conv.is_owned = false;
54991         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
54992         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
54993         return tag_ptr(ret_conv, true);
54994 }
54995
54996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
54997         LDKInitFeatures this_arg_conv;
54998         this_arg_conv.inner = untag_ptr(this_arg);
54999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55001         this_arg_conv.is_owned = false;
55002         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55003         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
55004         return tag_ptr(ret_conv, true);
55005 }
55006
55007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55008         LDKInitFeatures this_arg_conv;
55009         this_arg_conv.inner = untag_ptr(this_arg);
55010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55012         this_arg_conv.is_owned = false;
55013         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55014         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55015         return tag_ptr(ret_conv, true);
55016 }
55017
55018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
55019         LDKNodeFeatures ret_var = NodeFeatures_empty();
55020         int64_t ret_ref = 0;
55021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55023         return ret_ref;
55024 }
55025
55026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55027         LDKNodeFeatures this_arg_conv;
55028         this_arg_conv.inner = untag_ptr(this_arg);
55029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55031         this_arg_conv.is_owned = false;
55032         LDKNodeFeatures other_conv;
55033         other_conv.inner = untag_ptr(other);
55034         other_conv.is_owned = ptr_is_owned(other);
55035         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55036         other_conv.is_owned = false;
55037         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55038         return ret_conv;
55039 }
55040
55041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55042         LDKNodeFeatures this_arg_conv;
55043         this_arg_conv.inner = untag_ptr(this_arg);
55044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55046         this_arg_conv.is_owned = false;
55047         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
55048         return ret_conv;
55049 }
55050
55051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55052         LDKNodeFeatures this_arg_conv;
55053         this_arg_conv.inner = untag_ptr(this_arg);
55054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55056         this_arg_conv.is_owned = false;
55057         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55058         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
55059         return tag_ptr(ret_conv, true);
55060 }
55061
55062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55063         LDKNodeFeatures this_arg_conv;
55064         this_arg_conv.inner = untag_ptr(this_arg);
55065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55067         this_arg_conv.is_owned = false;
55068         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55069         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55070         return tag_ptr(ret_conv, true);
55071 }
55072
55073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55074         LDKNodeFeatures this_arg_conv;
55075         this_arg_conv.inner = untag_ptr(this_arg);
55076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55078         this_arg_conv.is_owned = false;
55079         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55080         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
55081         return tag_ptr(ret_conv, true);
55082 }
55083
55084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55085         LDKNodeFeatures this_arg_conv;
55086         this_arg_conv.inner = untag_ptr(this_arg);
55087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55089         this_arg_conv.is_owned = false;
55090         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55091         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55092         return tag_ptr(ret_conv, true);
55093 }
55094
55095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
55096         LDKChannelFeatures ret_var = ChannelFeatures_empty();
55097         int64_t ret_ref = 0;
55098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55100         return ret_ref;
55101 }
55102
55103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55104         LDKChannelFeatures this_arg_conv;
55105         this_arg_conv.inner = untag_ptr(this_arg);
55106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55108         this_arg_conv.is_owned = false;
55109         LDKChannelFeatures other_conv;
55110         other_conv.inner = untag_ptr(other);
55111         other_conv.is_owned = ptr_is_owned(other);
55112         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55113         other_conv.is_owned = false;
55114         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55115         return ret_conv;
55116 }
55117
55118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55119         LDKChannelFeatures this_arg_conv;
55120         this_arg_conv.inner = untag_ptr(this_arg);
55121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55123         this_arg_conv.is_owned = false;
55124         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
55125         return ret_conv;
55126 }
55127
55128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55129         LDKChannelFeatures this_arg_conv;
55130         this_arg_conv.inner = untag_ptr(this_arg);
55131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55133         this_arg_conv.is_owned = false;
55134         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55135         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
55136         return tag_ptr(ret_conv, true);
55137 }
55138
55139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55140         LDKChannelFeatures this_arg_conv;
55141         this_arg_conv.inner = untag_ptr(this_arg);
55142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55144         this_arg_conv.is_owned = false;
55145         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55146         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55147         return tag_ptr(ret_conv, true);
55148 }
55149
55150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55151         LDKChannelFeatures this_arg_conv;
55152         this_arg_conv.inner = untag_ptr(this_arg);
55153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55155         this_arg_conv.is_owned = false;
55156         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55157         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
55158         return tag_ptr(ret_conv, true);
55159 }
55160
55161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55162         LDKChannelFeatures this_arg_conv;
55163         this_arg_conv.inner = untag_ptr(this_arg);
55164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55166         this_arg_conv.is_owned = false;
55167         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55168         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55169         return tag_ptr(ret_conv, true);
55170 }
55171
55172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
55173         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
55174         int64_t ret_ref = 0;
55175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55177         return ret_ref;
55178 }
55179
55180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55181         LDKBolt11InvoiceFeatures this_arg_conv;
55182         this_arg_conv.inner = untag_ptr(this_arg);
55183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55185         this_arg_conv.is_owned = false;
55186         LDKBolt11InvoiceFeatures other_conv;
55187         other_conv.inner = untag_ptr(other);
55188         other_conv.is_owned = ptr_is_owned(other);
55189         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55190         other_conv.is_owned = false;
55191         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55192         return ret_conv;
55193 }
55194
55195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55196         LDKBolt11InvoiceFeatures this_arg_conv;
55197         this_arg_conv.inner = untag_ptr(this_arg);
55198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55200         this_arg_conv.is_owned = false;
55201         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55202         return ret_conv;
55203 }
55204
55205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55206         LDKBolt11InvoiceFeatures this_arg_conv;
55207         this_arg_conv.inner = untag_ptr(this_arg);
55208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55210         this_arg_conv.is_owned = false;
55211         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55212         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55213         return tag_ptr(ret_conv, true);
55214 }
55215
55216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55217         LDKBolt11InvoiceFeatures this_arg_conv;
55218         this_arg_conv.inner = untag_ptr(this_arg);
55219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55221         this_arg_conv.is_owned = false;
55222         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55223         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55224         return tag_ptr(ret_conv, true);
55225 }
55226
55227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55228         LDKBolt11InvoiceFeatures this_arg_conv;
55229         this_arg_conv.inner = untag_ptr(this_arg);
55230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55232         this_arg_conv.is_owned = false;
55233         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55234         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
55235         return tag_ptr(ret_conv, true);
55236 }
55237
55238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55239         LDKBolt11InvoiceFeatures this_arg_conv;
55240         this_arg_conv.inner = untag_ptr(this_arg);
55241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55243         this_arg_conv.is_owned = false;
55244         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55245         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55246         return tag_ptr(ret_conv, true);
55247 }
55248
55249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
55250         LDKOfferFeatures ret_var = OfferFeatures_empty();
55251         int64_t ret_ref = 0;
55252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55254         return ret_ref;
55255 }
55256
55257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55258         LDKOfferFeatures this_arg_conv;
55259         this_arg_conv.inner = untag_ptr(this_arg);
55260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55262         this_arg_conv.is_owned = false;
55263         LDKOfferFeatures other_conv;
55264         other_conv.inner = untag_ptr(other);
55265         other_conv.is_owned = ptr_is_owned(other);
55266         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55267         other_conv.is_owned = false;
55268         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55269         return ret_conv;
55270 }
55271
55272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55273         LDKOfferFeatures this_arg_conv;
55274         this_arg_conv.inner = untag_ptr(this_arg);
55275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55277         this_arg_conv.is_owned = false;
55278         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
55279         return ret_conv;
55280 }
55281
55282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55283         LDKOfferFeatures this_arg_conv;
55284         this_arg_conv.inner = untag_ptr(this_arg);
55285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55287         this_arg_conv.is_owned = false;
55288         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55289         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
55290         return tag_ptr(ret_conv, true);
55291 }
55292
55293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55294         LDKOfferFeatures this_arg_conv;
55295         this_arg_conv.inner = untag_ptr(this_arg);
55296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55298         this_arg_conv.is_owned = false;
55299         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55300         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55301         return tag_ptr(ret_conv, true);
55302 }
55303
55304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55305         LDKOfferFeatures this_arg_conv;
55306         this_arg_conv.inner = untag_ptr(this_arg);
55307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55309         this_arg_conv.is_owned = false;
55310         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55311         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
55312         return tag_ptr(ret_conv, true);
55313 }
55314
55315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55316         LDKOfferFeatures this_arg_conv;
55317         this_arg_conv.inner = untag_ptr(this_arg);
55318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55320         this_arg_conv.is_owned = false;
55321         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55322         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55323         return tag_ptr(ret_conv, true);
55324 }
55325
55326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
55327         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
55328         int64_t ret_ref = 0;
55329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55331         return ret_ref;
55332 }
55333
55334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55335         LDKInvoiceRequestFeatures this_arg_conv;
55336         this_arg_conv.inner = untag_ptr(this_arg);
55337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55339         this_arg_conv.is_owned = false;
55340         LDKInvoiceRequestFeatures other_conv;
55341         other_conv.inner = untag_ptr(other);
55342         other_conv.is_owned = ptr_is_owned(other);
55343         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55344         other_conv.is_owned = false;
55345         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55346         return ret_conv;
55347 }
55348
55349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55350         LDKInvoiceRequestFeatures this_arg_conv;
55351         this_arg_conv.inner = untag_ptr(this_arg);
55352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55354         this_arg_conv.is_owned = false;
55355         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
55356         return ret_conv;
55357 }
55358
55359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55360         LDKInvoiceRequestFeatures this_arg_conv;
55361         this_arg_conv.inner = untag_ptr(this_arg);
55362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55364         this_arg_conv.is_owned = false;
55365         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55366         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
55367         return tag_ptr(ret_conv, true);
55368 }
55369
55370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55371         LDKInvoiceRequestFeatures this_arg_conv;
55372         this_arg_conv.inner = untag_ptr(this_arg);
55373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55375         this_arg_conv.is_owned = false;
55376         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55377         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55378         return tag_ptr(ret_conv, true);
55379 }
55380
55381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55382         LDKInvoiceRequestFeatures this_arg_conv;
55383         this_arg_conv.inner = untag_ptr(this_arg);
55384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55386         this_arg_conv.is_owned = false;
55387         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55388         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
55389         return tag_ptr(ret_conv, true);
55390 }
55391
55392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55393         LDKInvoiceRequestFeatures this_arg_conv;
55394         this_arg_conv.inner = untag_ptr(this_arg);
55395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55397         this_arg_conv.is_owned = false;
55398         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55399         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55400         return tag_ptr(ret_conv, true);
55401 }
55402
55403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
55404         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
55405         int64_t ret_ref = 0;
55406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55408         return ret_ref;
55409 }
55410
55411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55412         LDKBolt12InvoiceFeatures this_arg_conv;
55413         this_arg_conv.inner = untag_ptr(this_arg);
55414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55416         this_arg_conv.is_owned = false;
55417         LDKBolt12InvoiceFeatures other_conv;
55418         other_conv.inner = untag_ptr(other);
55419         other_conv.is_owned = ptr_is_owned(other);
55420         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55421         other_conv.is_owned = false;
55422         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55423         return ret_conv;
55424 }
55425
55426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55427         LDKBolt12InvoiceFeatures this_arg_conv;
55428         this_arg_conv.inner = untag_ptr(this_arg);
55429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55431         this_arg_conv.is_owned = false;
55432         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55433         return ret_conv;
55434 }
55435
55436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55437         LDKBolt12InvoiceFeatures this_arg_conv;
55438         this_arg_conv.inner = untag_ptr(this_arg);
55439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55441         this_arg_conv.is_owned = false;
55442         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55443         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55444         return tag_ptr(ret_conv, true);
55445 }
55446
55447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55448         LDKBolt12InvoiceFeatures this_arg_conv;
55449         this_arg_conv.inner = untag_ptr(this_arg);
55450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55452         this_arg_conv.is_owned = false;
55453         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55454         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55455         return tag_ptr(ret_conv, true);
55456 }
55457
55458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55459         LDKBolt12InvoiceFeatures this_arg_conv;
55460         this_arg_conv.inner = untag_ptr(this_arg);
55461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55463         this_arg_conv.is_owned = false;
55464         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55465         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
55466         return tag_ptr(ret_conv, true);
55467 }
55468
55469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55470         LDKBolt12InvoiceFeatures this_arg_conv;
55471         this_arg_conv.inner = untag_ptr(this_arg);
55472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55474         this_arg_conv.is_owned = false;
55475         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55476         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55477         return tag_ptr(ret_conv, true);
55478 }
55479
55480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
55481         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
55482         int64_t ret_ref = 0;
55483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55485         return ret_ref;
55486 }
55487
55488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55489         LDKBlindedHopFeatures this_arg_conv;
55490         this_arg_conv.inner = untag_ptr(this_arg);
55491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55493         this_arg_conv.is_owned = false;
55494         LDKBlindedHopFeatures other_conv;
55495         other_conv.inner = untag_ptr(other);
55496         other_conv.is_owned = ptr_is_owned(other);
55497         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55498         other_conv.is_owned = false;
55499         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55500         return ret_conv;
55501 }
55502
55503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55504         LDKBlindedHopFeatures this_arg_conv;
55505         this_arg_conv.inner = untag_ptr(this_arg);
55506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55508         this_arg_conv.is_owned = false;
55509         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
55510         return ret_conv;
55511 }
55512
55513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55514         LDKBlindedHopFeatures this_arg_conv;
55515         this_arg_conv.inner = untag_ptr(this_arg);
55516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55518         this_arg_conv.is_owned = false;
55519         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55520         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
55521         return tag_ptr(ret_conv, true);
55522 }
55523
55524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55525         LDKBlindedHopFeatures this_arg_conv;
55526         this_arg_conv.inner = untag_ptr(this_arg);
55527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55529         this_arg_conv.is_owned = false;
55530         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55531         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55532         return tag_ptr(ret_conv, true);
55533 }
55534
55535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55536         LDKBlindedHopFeatures this_arg_conv;
55537         this_arg_conv.inner = untag_ptr(this_arg);
55538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55540         this_arg_conv.is_owned = false;
55541         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55542         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
55543         return tag_ptr(ret_conv, true);
55544 }
55545
55546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55547         LDKBlindedHopFeatures this_arg_conv;
55548         this_arg_conv.inner = untag_ptr(this_arg);
55549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55551         this_arg_conv.is_owned = false;
55552         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55553         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55554         return tag_ptr(ret_conv, true);
55555 }
55556
55557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
55558         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
55559         int64_t ret_ref = 0;
55560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55562         return ret_ref;
55563 }
55564
55565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55566         LDKChannelTypeFeatures this_arg_conv;
55567         this_arg_conv.inner = untag_ptr(this_arg);
55568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55570         this_arg_conv.is_owned = false;
55571         LDKChannelTypeFeatures other_conv;
55572         other_conv.inner = untag_ptr(other);
55573         other_conv.is_owned = ptr_is_owned(other);
55574         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55575         other_conv.is_owned = false;
55576         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55577         return ret_conv;
55578 }
55579
55580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55581         LDKChannelTypeFeatures this_arg_conv;
55582         this_arg_conv.inner = untag_ptr(this_arg);
55583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55585         this_arg_conv.is_owned = false;
55586         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
55587         return ret_conv;
55588 }
55589
55590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55591         LDKChannelTypeFeatures this_arg_conv;
55592         this_arg_conv.inner = untag_ptr(this_arg);
55593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55595         this_arg_conv.is_owned = false;
55596         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55597         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
55598         return tag_ptr(ret_conv, true);
55599 }
55600
55601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55602         LDKChannelTypeFeatures this_arg_conv;
55603         this_arg_conv.inner = untag_ptr(this_arg);
55604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55606         this_arg_conv.is_owned = false;
55607         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55608         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55609         return tag_ptr(ret_conv, true);
55610 }
55611
55612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55613         LDKChannelTypeFeatures this_arg_conv;
55614         this_arg_conv.inner = untag_ptr(this_arg);
55615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55617         this_arg_conv.is_owned = false;
55618         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55619         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
55620         return tag_ptr(ret_conv, true);
55621 }
55622
55623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
55624         LDKChannelTypeFeatures this_arg_conv;
55625         this_arg_conv.inner = untag_ptr(this_arg);
55626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55628         this_arg_conv.is_owned = false;
55629         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55630         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55631         return tag_ptr(ret_conv, true);
55632 }
55633
55634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55635         LDKInitFeatures obj_conv;
55636         obj_conv.inner = untag_ptr(obj);
55637         obj_conv.is_owned = ptr_is_owned(obj);
55638         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55639         obj_conv.is_owned = false;
55640         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
55641         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55642         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55643         CVec_u8Z_free(ret_var);
55644         return ret_arr;
55645 }
55646
55647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55648         LDKu8slice ser_ref;
55649         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55650         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55651         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
55652         *ret_conv = InitFeatures_read(ser_ref);
55653         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55654         return tag_ptr(ret_conv, true);
55655 }
55656
55657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55658         LDKChannelFeatures obj_conv;
55659         obj_conv.inner = untag_ptr(obj);
55660         obj_conv.is_owned = ptr_is_owned(obj);
55661         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55662         obj_conv.is_owned = false;
55663         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
55664         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55665         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55666         CVec_u8Z_free(ret_var);
55667         return ret_arr;
55668 }
55669
55670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55671         LDKu8slice ser_ref;
55672         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55673         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55674         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
55675         *ret_conv = ChannelFeatures_read(ser_ref);
55676         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55677         return tag_ptr(ret_conv, true);
55678 }
55679
55680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55681         LDKNodeFeatures obj_conv;
55682         obj_conv.inner = untag_ptr(obj);
55683         obj_conv.is_owned = ptr_is_owned(obj);
55684         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55685         obj_conv.is_owned = false;
55686         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
55687         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55688         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55689         CVec_u8Z_free(ret_var);
55690         return ret_arr;
55691 }
55692
55693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55694         LDKu8slice ser_ref;
55695         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55696         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55697         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
55698         *ret_conv = NodeFeatures_read(ser_ref);
55699         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55700         return tag_ptr(ret_conv, true);
55701 }
55702
55703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55704         LDKBolt11InvoiceFeatures obj_conv;
55705         obj_conv.inner = untag_ptr(obj);
55706         obj_conv.is_owned = ptr_is_owned(obj);
55707         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55708         obj_conv.is_owned = false;
55709         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
55710         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55711         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55712         CVec_u8Z_free(ret_var);
55713         return ret_arr;
55714 }
55715
55716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55717         LDKu8slice ser_ref;
55718         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55719         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55720         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
55721         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
55722         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55723         return tag_ptr(ret_conv, true);
55724 }
55725
55726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55727         LDKBolt12InvoiceFeatures obj_conv;
55728         obj_conv.inner = untag_ptr(obj);
55729         obj_conv.is_owned = ptr_is_owned(obj);
55730         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55731         obj_conv.is_owned = false;
55732         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
55733         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55734         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55735         CVec_u8Z_free(ret_var);
55736         return ret_arr;
55737 }
55738
55739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55740         LDKu8slice ser_ref;
55741         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55742         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55743         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
55744         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
55745         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55746         return tag_ptr(ret_conv, true);
55747 }
55748
55749 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55750         LDKBlindedHopFeatures obj_conv;
55751         obj_conv.inner = untag_ptr(obj);
55752         obj_conv.is_owned = ptr_is_owned(obj);
55753         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55754         obj_conv.is_owned = false;
55755         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
55756         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55757         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55758         CVec_u8Z_free(ret_var);
55759         return ret_arr;
55760 }
55761
55762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55763         LDKu8slice ser_ref;
55764         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55765         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55766         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
55767         *ret_conv = BlindedHopFeatures_read(ser_ref);
55768         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55769         return tag_ptr(ret_conv, true);
55770 }
55771
55772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
55773         LDKChannelTypeFeatures obj_conv;
55774         obj_conv.inner = untag_ptr(obj);
55775         obj_conv.is_owned = ptr_is_owned(obj);
55776         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55777         obj_conv.is_owned = false;
55778         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
55779         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55780         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55781         CVec_u8Z_free(ret_var);
55782         return ret_arr;
55783 }
55784
55785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55786         LDKu8slice ser_ref;
55787         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55788         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55789         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
55790         *ret_conv = ChannelTypeFeatures_read(ser_ref);
55791         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55792         return tag_ptr(ret_conv, true);
55793 }
55794
55795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55796         LDKInitFeatures this_arg_conv;
55797         this_arg_conv.inner = untag_ptr(this_arg);
55798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55800         this_arg_conv.is_owned = false;
55801         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
55802 }
55803
55804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55805         LDKInitFeatures this_arg_conv;
55806         this_arg_conv.inner = untag_ptr(this_arg);
55807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55809         this_arg_conv.is_owned = false;
55810         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
55811 }
55812
55813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
55814         LDKInitFeatures this_arg_conv;
55815         this_arg_conv.inner = untag_ptr(this_arg);
55816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55818         this_arg_conv.is_owned = false;
55819         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
55820         return ret_conv;
55821 }
55822
55823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55824         LDKNodeFeatures this_arg_conv;
55825         this_arg_conv.inner = untag_ptr(this_arg);
55826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55828         this_arg_conv.is_owned = false;
55829         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
55830 }
55831
55832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55833         LDKNodeFeatures this_arg_conv;
55834         this_arg_conv.inner = untag_ptr(this_arg);
55835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55837         this_arg_conv.is_owned = false;
55838         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
55839 }
55840
55841 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
55842         LDKNodeFeatures this_arg_conv;
55843         this_arg_conv.inner = untag_ptr(this_arg);
55844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55846         this_arg_conv.is_owned = false;
55847         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
55848         return ret_conv;
55849 }
55850
55851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
55852         LDKInitFeatures this_arg_conv;
55853         this_arg_conv.inner = untag_ptr(this_arg);
55854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55856         this_arg_conv.is_owned = false;
55857         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
55858         return ret_conv;
55859 }
55860
55861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
55862         LDKNodeFeatures this_arg_conv;
55863         this_arg_conv.inner = untag_ptr(this_arg);
55864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55866         this_arg_conv.is_owned = false;
55867         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
55868         return ret_conv;
55869 }
55870
55871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55872         LDKInitFeatures this_arg_conv;
55873         this_arg_conv.inner = untag_ptr(this_arg);
55874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55876         this_arg_conv.is_owned = false;
55877         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
55878 }
55879
55880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55881         LDKInitFeatures this_arg_conv;
55882         this_arg_conv.inner = untag_ptr(this_arg);
55883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55885         this_arg_conv.is_owned = false;
55886         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
55887 }
55888
55889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
55890         LDKInitFeatures this_arg_conv;
55891         this_arg_conv.inner = untag_ptr(this_arg);
55892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55894         this_arg_conv.is_owned = false;
55895         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
55896         return ret_conv;
55897 }
55898
55899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55900         LDKInitFeatures this_arg_conv;
55901         this_arg_conv.inner = untag_ptr(this_arg);
55902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55904         this_arg_conv.is_owned = false;
55905         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
55906 }
55907
55908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55909         LDKInitFeatures this_arg_conv;
55910         this_arg_conv.inner = untag_ptr(this_arg);
55911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55913         this_arg_conv.is_owned = false;
55914         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
55915 }
55916
55917 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
55918         LDKInitFeatures this_arg_conv;
55919         this_arg_conv.inner = untag_ptr(this_arg);
55920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55922         this_arg_conv.is_owned = false;
55923         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
55924         return ret_conv;
55925 }
55926
55927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55928         LDKNodeFeatures this_arg_conv;
55929         this_arg_conv.inner = untag_ptr(this_arg);
55930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55932         this_arg_conv.is_owned = false;
55933         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
55934 }
55935
55936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55937         LDKNodeFeatures this_arg_conv;
55938         this_arg_conv.inner = untag_ptr(this_arg);
55939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55941         this_arg_conv.is_owned = false;
55942         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
55943 }
55944
55945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
55946         LDKNodeFeatures this_arg_conv;
55947         this_arg_conv.inner = untag_ptr(this_arg);
55948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55950         this_arg_conv.is_owned = false;
55951         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
55952         return ret_conv;
55953 }
55954
55955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
55956         LDKInitFeatures this_arg_conv;
55957         this_arg_conv.inner = untag_ptr(this_arg);
55958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55960         this_arg_conv.is_owned = false;
55961         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
55962         return ret_conv;
55963 }
55964
55965 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
55966         LDKNodeFeatures this_arg_conv;
55967         this_arg_conv.inner = untag_ptr(this_arg);
55968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55970         this_arg_conv.is_owned = false;
55971         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
55972         return ret_conv;
55973 }
55974
55975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
55976         LDKInitFeatures this_arg_conv;
55977         this_arg_conv.inner = untag_ptr(this_arg);
55978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55980         this_arg_conv.is_owned = false;
55981         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
55982 }
55983
55984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
55985         LDKInitFeatures this_arg_conv;
55986         this_arg_conv.inner = untag_ptr(this_arg);
55987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55989         this_arg_conv.is_owned = false;
55990         InitFeatures_set_gossip_queries_required(&this_arg_conv);
55991 }
55992
55993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
55994         LDKInitFeatures this_arg_conv;
55995         this_arg_conv.inner = untag_ptr(this_arg);
55996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55998         this_arg_conv.is_owned = false;
55999         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
56000         return ret_conv;
56001 }
56002
56003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56004         LDKNodeFeatures this_arg_conv;
56005         this_arg_conv.inner = untag_ptr(this_arg);
56006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56008         this_arg_conv.is_owned = false;
56009         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
56010 }
56011
56012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56013         LDKNodeFeatures this_arg_conv;
56014         this_arg_conv.inner = untag_ptr(this_arg);
56015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56017         this_arg_conv.is_owned = false;
56018         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
56019 }
56020
56021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56022         LDKNodeFeatures this_arg_conv;
56023         this_arg_conv.inner = untag_ptr(this_arg);
56024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56026         this_arg_conv.is_owned = false;
56027         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
56028         return ret_conv;
56029 }
56030
56031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56032         LDKInitFeatures this_arg_conv;
56033         this_arg_conv.inner = untag_ptr(this_arg);
56034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56036         this_arg_conv.is_owned = false;
56037         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
56038         return ret_conv;
56039 }
56040
56041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56042         LDKNodeFeatures this_arg_conv;
56043         this_arg_conv.inner = untag_ptr(this_arg);
56044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56046         this_arg_conv.is_owned = false;
56047         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
56048         return ret_conv;
56049 }
56050
56051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56052         LDKInitFeatures this_arg_conv;
56053         this_arg_conv.inner = untag_ptr(this_arg);
56054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56056         this_arg_conv.is_owned = false;
56057         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
56058 }
56059
56060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56061         LDKInitFeatures this_arg_conv;
56062         this_arg_conv.inner = untag_ptr(this_arg);
56063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56065         this_arg_conv.is_owned = false;
56066         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
56067 }
56068
56069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56070         LDKInitFeatures this_arg_conv;
56071         this_arg_conv.inner = untag_ptr(this_arg);
56072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56074         this_arg_conv.is_owned = false;
56075         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
56076         return ret_conv;
56077 }
56078
56079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56080         LDKNodeFeatures this_arg_conv;
56081         this_arg_conv.inner = untag_ptr(this_arg);
56082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56084         this_arg_conv.is_owned = false;
56085         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
56086 }
56087
56088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56089         LDKNodeFeatures this_arg_conv;
56090         this_arg_conv.inner = untag_ptr(this_arg);
56091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56093         this_arg_conv.is_owned = false;
56094         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
56095 }
56096
56097 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56098         LDKNodeFeatures this_arg_conv;
56099         this_arg_conv.inner = untag_ptr(this_arg);
56100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56102         this_arg_conv.is_owned = false;
56103         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
56104         return ret_conv;
56105 }
56106
56107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56108         LDKBolt11InvoiceFeatures this_arg_conv;
56109         this_arg_conv.inner = untag_ptr(this_arg);
56110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56112         this_arg_conv.is_owned = false;
56113         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
56114 }
56115
56116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56117         LDKBolt11InvoiceFeatures this_arg_conv;
56118         this_arg_conv.inner = untag_ptr(this_arg);
56119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56121         this_arg_conv.is_owned = false;
56122         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
56123 }
56124
56125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56126         LDKBolt11InvoiceFeatures this_arg_conv;
56127         this_arg_conv.inner = untag_ptr(this_arg);
56128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56130         this_arg_conv.is_owned = false;
56131         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
56132         return ret_conv;
56133 }
56134
56135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56136         LDKInitFeatures this_arg_conv;
56137         this_arg_conv.inner = untag_ptr(this_arg);
56138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56140         this_arg_conv.is_owned = false;
56141         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
56142         return ret_conv;
56143 }
56144
56145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56146         LDKNodeFeatures this_arg_conv;
56147         this_arg_conv.inner = untag_ptr(this_arg);
56148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56150         this_arg_conv.is_owned = false;
56151         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
56152         return ret_conv;
56153 }
56154
56155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56156         LDKBolt11InvoiceFeatures this_arg_conv;
56157         this_arg_conv.inner = untag_ptr(this_arg);
56158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56160         this_arg_conv.is_owned = false;
56161         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
56162         return ret_conv;
56163 }
56164
56165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56166         LDKInitFeatures this_arg_conv;
56167         this_arg_conv.inner = untag_ptr(this_arg);
56168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56170         this_arg_conv.is_owned = false;
56171         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
56172 }
56173
56174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56175         LDKInitFeatures this_arg_conv;
56176         this_arg_conv.inner = untag_ptr(this_arg);
56177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56179         this_arg_conv.is_owned = false;
56180         InitFeatures_set_static_remote_key_required(&this_arg_conv);
56181 }
56182
56183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56184         LDKInitFeatures this_arg_conv;
56185         this_arg_conv.inner = untag_ptr(this_arg);
56186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56188         this_arg_conv.is_owned = false;
56189         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
56190         return ret_conv;
56191 }
56192
56193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56194         LDKNodeFeatures this_arg_conv;
56195         this_arg_conv.inner = untag_ptr(this_arg);
56196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56198         this_arg_conv.is_owned = false;
56199         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
56200 }
56201
56202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56203         LDKNodeFeatures this_arg_conv;
56204         this_arg_conv.inner = untag_ptr(this_arg);
56205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56207         this_arg_conv.is_owned = false;
56208         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
56209 }
56210
56211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56212         LDKNodeFeatures this_arg_conv;
56213         this_arg_conv.inner = untag_ptr(this_arg);
56214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56216         this_arg_conv.is_owned = false;
56217         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
56218         return ret_conv;
56219 }
56220
56221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56222         LDKChannelTypeFeatures this_arg_conv;
56223         this_arg_conv.inner = untag_ptr(this_arg);
56224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56226         this_arg_conv.is_owned = false;
56227         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
56228 }
56229
56230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56231         LDKChannelTypeFeatures this_arg_conv;
56232         this_arg_conv.inner = untag_ptr(this_arg);
56233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56235         this_arg_conv.is_owned = false;
56236         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
56237 }
56238
56239 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56240         LDKChannelTypeFeatures this_arg_conv;
56241         this_arg_conv.inner = untag_ptr(this_arg);
56242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56244         this_arg_conv.is_owned = false;
56245         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
56246         return ret_conv;
56247 }
56248
56249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56250         LDKInitFeatures this_arg_conv;
56251         this_arg_conv.inner = untag_ptr(this_arg);
56252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56254         this_arg_conv.is_owned = false;
56255         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
56256         return ret_conv;
56257 }
56258
56259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56260         LDKNodeFeatures this_arg_conv;
56261         this_arg_conv.inner = untag_ptr(this_arg);
56262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56264         this_arg_conv.is_owned = false;
56265         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
56266         return ret_conv;
56267 }
56268
56269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56270         LDKChannelTypeFeatures this_arg_conv;
56271         this_arg_conv.inner = untag_ptr(this_arg);
56272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56274         this_arg_conv.is_owned = false;
56275         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
56276         return ret_conv;
56277 }
56278
56279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56280         LDKInitFeatures this_arg_conv;
56281         this_arg_conv.inner = untag_ptr(this_arg);
56282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56284         this_arg_conv.is_owned = false;
56285         InitFeatures_set_payment_secret_optional(&this_arg_conv);
56286 }
56287
56288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56289         LDKInitFeatures this_arg_conv;
56290         this_arg_conv.inner = untag_ptr(this_arg);
56291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56293         this_arg_conv.is_owned = false;
56294         InitFeatures_set_payment_secret_required(&this_arg_conv);
56295 }
56296
56297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56298         LDKInitFeatures this_arg_conv;
56299         this_arg_conv.inner = untag_ptr(this_arg);
56300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56302         this_arg_conv.is_owned = false;
56303         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
56304         return ret_conv;
56305 }
56306
56307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56308         LDKNodeFeatures this_arg_conv;
56309         this_arg_conv.inner = untag_ptr(this_arg);
56310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56312         this_arg_conv.is_owned = false;
56313         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
56314 }
56315
56316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56317         LDKNodeFeatures this_arg_conv;
56318         this_arg_conv.inner = untag_ptr(this_arg);
56319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56321         this_arg_conv.is_owned = false;
56322         NodeFeatures_set_payment_secret_required(&this_arg_conv);
56323 }
56324
56325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56326         LDKNodeFeatures this_arg_conv;
56327         this_arg_conv.inner = untag_ptr(this_arg);
56328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56330         this_arg_conv.is_owned = false;
56331         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
56332         return ret_conv;
56333 }
56334
56335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56336         LDKBolt11InvoiceFeatures this_arg_conv;
56337         this_arg_conv.inner = untag_ptr(this_arg);
56338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56340         this_arg_conv.is_owned = false;
56341         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
56342 }
56343
56344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56345         LDKBolt11InvoiceFeatures this_arg_conv;
56346         this_arg_conv.inner = untag_ptr(this_arg);
56347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56349         this_arg_conv.is_owned = false;
56350         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
56351 }
56352
56353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56354         LDKBolt11InvoiceFeatures this_arg_conv;
56355         this_arg_conv.inner = untag_ptr(this_arg);
56356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56358         this_arg_conv.is_owned = false;
56359         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
56360         return ret_conv;
56361 }
56362
56363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56364         LDKInitFeatures this_arg_conv;
56365         this_arg_conv.inner = untag_ptr(this_arg);
56366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56368         this_arg_conv.is_owned = false;
56369         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
56370         return ret_conv;
56371 }
56372
56373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56374         LDKNodeFeatures this_arg_conv;
56375         this_arg_conv.inner = untag_ptr(this_arg);
56376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56378         this_arg_conv.is_owned = false;
56379         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
56380         return ret_conv;
56381 }
56382
56383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56384         LDKBolt11InvoiceFeatures this_arg_conv;
56385         this_arg_conv.inner = untag_ptr(this_arg);
56386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56388         this_arg_conv.is_owned = false;
56389         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
56390         return ret_conv;
56391 }
56392
56393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56394         LDKInitFeatures this_arg_conv;
56395         this_arg_conv.inner = untag_ptr(this_arg);
56396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56398         this_arg_conv.is_owned = false;
56399         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
56400 }
56401
56402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56403         LDKInitFeatures this_arg_conv;
56404         this_arg_conv.inner = untag_ptr(this_arg);
56405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56407         this_arg_conv.is_owned = false;
56408         InitFeatures_set_basic_mpp_required(&this_arg_conv);
56409 }
56410
56411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56412         LDKInitFeatures this_arg_conv;
56413         this_arg_conv.inner = untag_ptr(this_arg);
56414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56416         this_arg_conv.is_owned = false;
56417         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
56418         return ret_conv;
56419 }
56420
56421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56422         LDKNodeFeatures this_arg_conv;
56423         this_arg_conv.inner = untag_ptr(this_arg);
56424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56426         this_arg_conv.is_owned = false;
56427         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
56428 }
56429
56430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56431         LDKNodeFeatures this_arg_conv;
56432         this_arg_conv.inner = untag_ptr(this_arg);
56433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56435         this_arg_conv.is_owned = false;
56436         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
56437 }
56438
56439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56440         LDKNodeFeatures this_arg_conv;
56441         this_arg_conv.inner = untag_ptr(this_arg);
56442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56444         this_arg_conv.is_owned = false;
56445         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
56446         return ret_conv;
56447 }
56448
56449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56450         LDKBolt11InvoiceFeatures this_arg_conv;
56451         this_arg_conv.inner = untag_ptr(this_arg);
56452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56454         this_arg_conv.is_owned = false;
56455         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
56456 }
56457
56458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56459         LDKBolt11InvoiceFeatures this_arg_conv;
56460         this_arg_conv.inner = untag_ptr(this_arg);
56461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56463         this_arg_conv.is_owned = false;
56464         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
56465 }
56466
56467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56468         LDKBolt11InvoiceFeatures this_arg_conv;
56469         this_arg_conv.inner = untag_ptr(this_arg);
56470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56472         this_arg_conv.is_owned = false;
56473         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
56474         return ret_conv;
56475 }
56476
56477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56478         LDKBolt12InvoiceFeatures this_arg_conv;
56479         this_arg_conv.inner = untag_ptr(this_arg);
56480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56482         this_arg_conv.is_owned = false;
56483         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
56484 }
56485
56486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56487         LDKBolt12InvoiceFeatures this_arg_conv;
56488         this_arg_conv.inner = untag_ptr(this_arg);
56489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56491         this_arg_conv.is_owned = false;
56492         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
56493 }
56494
56495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56496         LDKBolt12InvoiceFeatures this_arg_conv;
56497         this_arg_conv.inner = untag_ptr(this_arg);
56498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56500         this_arg_conv.is_owned = false;
56501         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
56502         return ret_conv;
56503 }
56504
56505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56506         LDKInitFeatures this_arg_conv;
56507         this_arg_conv.inner = untag_ptr(this_arg);
56508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56510         this_arg_conv.is_owned = false;
56511         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
56512         return ret_conv;
56513 }
56514
56515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56516         LDKNodeFeatures this_arg_conv;
56517         this_arg_conv.inner = untag_ptr(this_arg);
56518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56520         this_arg_conv.is_owned = false;
56521         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
56522         return ret_conv;
56523 }
56524
56525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56526         LDKBolt11InvoiceFeatures this_arg_conv;
56527         this_arg_conv.inner = untag_ptr(this_arg);
56528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56530         this_arg_conv.is_owned = false;
56531         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
56532         return ret_conv;
56533 }
56534
56535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
56536         LDKBolt12InvoiceFeatures this_arg_conv;
56537         this_arg_conv.inner = untag_ptr(this_arg);
56538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56540         this_arg_conv.is_owned = false;
56541         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
56542         return ret_conv;
56543 }
56544
56545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56546         LDKInitFeatures this_arg_conv;
56547         this_arg_conv.inner = untag_ptr(this_arg);
56548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56550         this_arg_conv.is_owned = false;
56551         InitFeatures_set_wumbo_optional(&this_arg_conv);
56552 }
56553
56554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56555         LDKInitFeatures this_arg_conv;
56556         this_arg_conv.inner = untag_ptr(this_arg);
56557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56559         this_arg_conv.is_owned = false;
56560         InitFeatures_set_wumbo_required(&this_arg_conv);
56561 }
56562
56563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
56564         LDKInitFeatures this_arg_conv;
56565         this_arg_conv.inner = untag_ptr(this_arg);
56566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56568         this_arg_conv.is_owned = false;
56569         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
56570         return ret_conv;
56571 }
56572
56573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56574         LDKNodeFeatures this_arg_conv;
56575         this_arg_conv.inner = untag_ptr(this_arg);
56576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56578         this_arg_conv.is_owned = false;
56579         NodeFeatures_set_wumbo_optional(&this_arg_conv);
56580 }
56581
56582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56583         LDKNodeFeatures this_arg_conv;
56584         this_arg_conv.inner = untag_ptr(this_arg);
56585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56587         this_arg_conv.is_owned = false;
56588         NodeFeatures_set_wumbo_required(&this_arg_conv);
56589 }
56590
56591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
56592         LDKNodeFeatures this_arg_conv;
56593         this_arg_conv.inner = untag_ptr(this_arg);
56594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56596         this_arg_conv.is_owned = false;
56597         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
56598         return ret_conv;
56599 }
56600
56601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
56602         LDKInitFeatures this_arg_conv;
56603         this_arg_conv.inner = untag_ptr(this_arg);
56604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56606         this_arg_conv.is_owned = false;
56607         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
56608         return ret_conv;
56609 }
56610
56611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
56612         LDKNodeFeatures this_arg_conv;
56613         this_arg_conv.inner = untag_ptr(this_arg);
56614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56616         this_arg_conv.is_owned = false;
56617         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
56618         return ret_conv;
56619 }
56620
56621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56622         LDKInitFeatures this_arg_conv;
56623         this_arg_conv.inner = untag_ptr(this_arg);
56624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56626         this_arg_conv.is_owned = false;
56627         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
56628 }
56629
56630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56631         LDKInitFeatures this_arg_conv;
56632         this_arg_conv.inner = untag_ptr(this_arg);
56633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56635         this_arg_conv.is_owned = false;
56636         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
56637 }
56638
56639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56640         LDKInitFeatures this_arg_conv;
56641         this_arg_conv.inner = untag_ptr(this_arg);
56642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56644         this_arg_conv.is_owned = false;
56645         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56646         return ret_conv;
56647 }
56648
56649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56650         LDKNodeFeatures this_arg_conv;
56651         this_arg_conv.inner = untag_ptr(this_arg);
56652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56654         this_arg_conv.is_owned = false;
56655         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
56656 }
56657
56658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56659         LDKNodeFeatures this_arg_conv;
56660         this_arg_conv.inner = untag_ptr(this_arg);
56661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56663         this_arg_conv.is_owned = false;
56664         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
56665 }
56666
56667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56668         LDKNodeFeatures this_arg_conv;
56669         this_arg_conv.inner = untag_ptr(this_arg);
56670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56672         this_arg_conv.is_owned = false;
56673         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56674         return ret_conv;
56675 }
56676
56677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56678         LDKChannelTypeFeatures this_arg_conv;
56679         this_arg_conv.inner = untag_ptr(this_arg);
56680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56682         this_arg_conv.is_owned = false;
56683         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
56684 }
56685
56686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56687         LDKChannelTypeFeatures this_arg_conv;
56688         this_arg_conv.inner = untag_ptr(this_arg);
56689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56691         this_arg_conv.is_owned = false;
56692         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
56693 }
56694
56695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56696         LDKChannelTypeFeatures this_arg_conv;
56697         this_arg_conv.inner = untag_ptr(this_arg);
56698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56700         this_arg_conv.is_owned = false;
56701         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56702         return ret_conv;
56703 }
56704
56705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56706         LDKInitFeatures this_arg_conv;
56707         this_arg_conv.inner = untag_ptr(this_arg);
56708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56710         this_arg_conv.is_owned = false;
56711         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56712         return ret_conv;
56713 }
56714
56715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56716         LDKNodeFeatures this_arg_conv;
56717         this_arg_conv.inner = untag_ptr(this_arg);
56718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56720         this_arg_conv.is_owned = false;
56721         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56722         return ret_conv;
56723 }
56724
56725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56726         LDKChannelTypeFeatures this_arg_conv;
56727         this_arg_conv.inner = untag_ptr(this_arg);
56728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56730         this_arg_conv.is_owned = false;
56731         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
56732         return ret_conv;
56733 }
56734
56735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56736         LDKInitFeatures this_arg_conv;
56737         this_arg_conv.inner = untag_ptr(this_arg);
56738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56740         this_arg_conv.is_owned = false;
56741         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
56742 }
56743
56744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56745         LDKInitFeatures this_arg_conv;
56746         this_arg_conv.inner = untag_ptr(this_arg);
56747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56749         this_arg_conv.is_owned = false;
56750         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
56751 }
56752
56753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56754         LDKInitFeatures this_arg_conv;
56755         this_arg_conv.inner = untag_ptr(this_arg);
56756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56758         this_arg_conv.is_owned = false;
56759         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
56760         return ret_conv;
56761 }
56762
56763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56764         LDKNodeFeatures this_arg_conv;
56765         this_arg_conv.inner = untag_ptr(this_arg);
56766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56768         this_arg_conv.is_owned = false;
56769         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
56770 }
56771
56772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56773         LDKNodeFeatures this_arg_conv;
56774         this_arg_conv.inner = untag_ptr(this_arg);
56775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56777         this_arg_conv.is_owned = false;
56778         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
56779 }
56780
56781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56782         LDKNodeFeatures this_arg_conv;
56783         this_arg_conv.inner = untag_ptr(this_arg);
56784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56786         this_arg_conv.is_owned = false;
56787         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
56788         return ret_conv;
56789 }
56790
56791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56792         LDKChannelTypeFeatures this_arg_conv;
56793         this_arg_conv.inner = untag_ptr(this_arg);
56794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56796         this_arg_conv.is_owned = false;
56797         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
56798 }
56799
56800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56801         LDKChannelTypeFeatures this_arg_conv;
56802         this_arg_conv.inner = untag_ptr(this_arg);
56803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56805         this_arg_conv.is_owned = false;
56806         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
56807 }
56808
56809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56810         LDKChannelTypeFeatures this_arg_conv;
56811         this_arg_conv.inner = untag_ptr(this_arg);
56812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56814         this_arg_conv.is_owned = false;
56815         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
56816         return ret_conv;
56817 }
56818
56819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56820         LDKInitFeatures this_arg_conv;
56821         this_arg_conv.inner = untag_ptr(this_arg);
56822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56824         this_arg_conv.is_owned = false;
56825         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
56826         return ret_conv;
56827 }
56828
56829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56830         LDKNodeFeatures this_arg_conv;
56831         this_arg_conv.inner = untag_ptr(this_arg);
56832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56834         this_arg_conv.is_owned = false;
56835         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
56836         return ret_conv;
56837 }
56838
56839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
56840         LDKChannelTypeFeatures this_arg_conv;
56841         this_arg_conv.inner = untag_ptr(this_arg);
56842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56844         this_arg_conv.is_owned = false;
56845         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
56846         return ret_conv;
56847 }
56848
56849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56850         LDKInitFeatures this_arg_conv;
56851         this_arg_conv.inner = untag_ptr(this_arg);
56852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56854         this_arg_conv.is_owned = false;
56855         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
56856 }
56857
56858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56859         LDKInitFeatures this_arg_conv;
56860         this_arg_conv.inner = untag_ptr(this_arg);
56861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56863         this_arg_conv.is_owned = false;
56864         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
56865 }
56866
56867 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
56868         LDKInitFeatures this_arg_conv;
56869         this_arg_conv.inner = untag_ptr(this_arg);
56870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56872         this_arg_conv.is_owned = false;
56873         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
56874         return ret_conv;
56875 }
56876
56877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56878         LDKNodeFeatures this_arg_conv;
56879         this_arg_conv.inner = untag_ptr(this_arg);
56880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56882         this_arg_conv.is_owned = false;
56883         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
56884 }
56885
56886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56887         LDKNodeFeatures this_arg_conv;
56888         this_arg_conv.inner = untag_ptr(this_arg);
56889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56891         this_arg_conv.is_owned = false;
56892         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
56893 }
56894
56895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
56896         LDKNodeFeatures this_arg_conv;
56897         this_arg_conv.inner = untag_ptr(this_arg);
56898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56900         this_arg_conv.is_owned = false;
56901         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
56902         return ret_conv;
56903 }
56904
56905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
56906         LDKInitFeatures this_arg_conv;
56907         this_arg_conv.inner = untag_ptr(this_arg);
56908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56910         this_arg_conv.is_owned = false;
56911         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
56912         return ret_conv;
56913 }
56914
56915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
56916         LDKNodeFeatures this_arg_conv;
56917         this_arg_conv.inner = untag_ptr(this_arg);
56918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56920         this_arg_conv.is_owned = false;
56921         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
56922         return ret_conv;
56923 }
56924
56925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56926         LDKInitFeatures this_arg_conv;
56927         this_arg_conv.inner = untag_ptr(this_arg);
56928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56930         this_arg_conv.is_owned = false;
56931         InitFeatures_set_taproot_optional(&this_arg_conv);
56932 }
56933
56934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56935         LDKInitFeatures this_arg_conv;
56936         this_arg_conv.inner = untag_ptr(this_arg);
56937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56939         this_arg_conv.is_owned = false;
56940         InitFeatures_set_taproot_required(&this_arg_conv);
56941 }
56942
56943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
56944         LDKInitFeatures this_arg_conv;
56945         this_arg_conv.inner = untag_ptr(this_arg);
56946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56948         this_arg_conv.is_owned = false;
56949         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
56950         return ret_conv;
56951 }
56952
56953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56954         LDKNodeFeatures this_arg_conv;
56955         this_arg_conv.inner = untag_ptr(this_arg);
56956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56958         this_arg_conv.is_owned = false;
56959         NodeFeatures_set_taproot_optional(&this_arg_conv);
56960 }
56961
56962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56963         LDKNodeFeatures this_arg_conv;
56964         this_arg_conv.inner = untag_ptr(this_arg);
56965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56967         this_arg_conv.is_owned = false;
56968         NodeFeatures_set_taproot_required(&this_arg_conv);
56969 }
56970
56971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
56972         LDKNodeFeatures this_arg_conv;
56973         this_arg_conv.inner = untag_ptr(this_arg);
56974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56976         this_arg_conv.is_owned = false;
56977         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
56978         return ret_conv;
56979 }
56980
56981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56982         LDKChannelTypeFeatures this_arg_conv;
56983         this_arg_conv.inner = untag_ptr(this_arg);
56984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56986         this_arg_conv.is_owned = false;
56987         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
56988 }
56989
56990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56991         LDKChannelTypeFeatures this_arg_conv;
56992         this_arg_conv.inner = untag_ptr(this_arg);
56993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56995         this_arg_conv.is_owned = false;
56996         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
56997 }
56998
56999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57000         LDKChannelTypeFeatures this_arg_conv;
57001         this_arg_conv.inner = untag_ptr(this_arg);
57002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57004         this_arg_conv.is_owned = false;
57005         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
57006         return ret_conv;
57007 }
57008
57009 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57010         LDKInitFeatures this_arg_conv;
57011         this_arg_conv.inner = untag_ptr(this_arg);
57012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57014         this_arg_conv.is_owned = false;
57015         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
57016         return ret_conv;
57017 }
57018
57019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57020         LDKNodeFeatures this_arg_conv;
57021         this_arg_conv.inner = untag_ptr(this_arg);
57022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57024         this_arg_conv.is_owned = false;
57025         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
57026         return ret_conv;
57027 }
57028
57029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57030         LDKChannelTypeFeatures this_arg_conv;
57031         this_arg_conv.inner = untag_ptr(this_arg);
57032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57034         this_arg_conv.is_owned = false;
57035         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
57036         return ret_conv;
57037 }
57038
57039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57040         LDKInitFeatures this_arg_conv;
57041         this_arg_conv.inner = untag_ptr(this_arg);
57042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57044         this_arg_conv.is_owned = false;
57045         InitFeatures_set_onion_messages_optional(&this_arg_conv);
57046 }
57047
57048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57049         LDKInitFeatures this_arg_conv;
57050         this_arg_conv.inner = untag_ptr(this_arg);
57051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57053         this_arg_conv.is_owned = false;
57054         InitFeatures_set_onion_messages_required(&this_arg_conv);
57055 }
57056
57057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57058         LDKInitFeatures this_arg_conv;
57059         this_arg_conv.inner = untag_ptr(this_arg);
57060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57062         this_arg_conv.is_owned = false;
57063         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
57064         return ret_conv;
57065 }
57066
57067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57068         LDKNodeFeatures this_arg_conv;
57069         this_arg_conv.inner = untag_ptr(this_arg);
57070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57072         this_arg_conv.is_owned = false;
57073         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
57074 }
57075
57076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57077         LDKNodeFeatures this_arg_conv;
57078         this_arg_conv.inner = untag_ptr(this_arg);
57079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57081         this_arg_conv.is_owned = false;
57082         NodeFeatures_set_onion_messages_required(&this_arg_conv);
57083 }
57084
57085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57086         LDKNodeFeatures this_arg_conv;
57087         this_arg_conv.inner = untag_ptr(this_arg);
57088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57090         this_arg_conv.is_owned = false;
57091         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
57092         return ret_conv;
57093 }
57094
57095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57096         LDKInitFeatures this_arg_conv;
57097         this_arg_conv.inner = untag_ptr(this_arg);
57098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57100         this_arg_conv.is_owned = false;
57101         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
57102         return ret_conv;
57103 }
57104
57105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57106         LDKNodeFeatures this_arg_conv;
57107         this_arg_conv.inner = untag_ptr(this_arg);
57108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57110         this_arg_conv.is_owned = false;
57111         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
57112         return ret_conv;
57113 }
57114
57115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57116         LDKInitFeatures this_arg_conv;
57117         this_arg_conv.inner = untag_ptr(this_arg);
57118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57120         this_arg_conv.is_owned = false;
57121         InitFeatures_set_channel_type_optional(&this_arg_conv);
57122 }
57123
57124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57125         LDKInitFeatures this_arg_conv;
57126         this_arg_conv.inner = untag_ptr(this_arg);
57127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57129         this_arg_conv.is_owned = false;
57130         InitFeatures_set_channel_type_required(&this_arg_conv);
57131 }
57132
57133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57134         LDKInitFeatures this_arg_conv;
57135         this_arg_conv.inner = untag_ptr(this_arg);
57136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57138         this_arg_conv.is_owned = false;
57139         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
57140         return ret_conv;
57141 }
57142
57143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57144         LDKNodeFeatures this_arg_conv;
57145         this_arg_conv.inner = untag_ptr(this_arg);
57146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57148         this_arg_conv.is_owned = false;
57149         NodeFeatures_set_channel_type_optional(&this_arg_conv);
57150 }
57151
57152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57153         LDKNodeFeatures this_arg_conv;
57154         this_arg_conv.inner = untag_ptr(this_arg);
57155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57157         this_arg_conv.is_owned = false;
57158         NodeFeatures_set_channel_type_required(&this_arg_conv);
57159 }
57160
57161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57162         LDKNodeFeatures this_arg_conv;
57163         this_arg_conv.inner = untag_ptr(this_arg);
57164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57166         this_arg_conv.is_owned = false;
57167         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
57168         return ret_conv;
57169 }
57170
57171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57172         LDKInitFeatures this_arg_conv;
57173         this_arg_conv.inner = untag_ptr(this_arg);
57174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57176         this_arg_conv.is_owned = false;
57177         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
57178         return ret_conv;
57179 }
57180
57181 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57182         LDKNodeFeatures this_arg_conv;
57183         this_arg_conv.inner = untag_ptr(this_arg);
57184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57186         this_arg_conv.is_owned = false;
57187         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
57188         return ret_conv;
57189 }
57190
57191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57192         LDKInitFeatures this_arg_conv;
57193         this_arg_conv.inner = untag_ptr(this_arg);
57194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57196         this_arg_conv.is_owned = false;
57197         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
57198 }
57199
57200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57201         LDKInitFeatures this_arg_conv;
57202         this_arg_conv.inner = untag_ptr(this_arg);
57203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57205         this_arg_conv.is_owned = false;
57206         InitFeatures_set_scid_privacy_required(&this_arg_conv);
57207 }
57208
57209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57210         LDKInitFeatures this_arg_conv;
57211         this_arg_conv.inner = untag_ptr(this_arg);
57212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57214         this_arg_conv.is_owned = false;
57215         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
57216         return ret_conv;
57217 }
57218
57219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57220         LDKNodeFeatures this_arg_conv;
57221         this_arg_conv.inner = untag_ptr(this_arg);
57222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57224         this_arg_conv.is_owned = false;
57225         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
57226 }
57227
57228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57229         LDKNodeFeatures this_arg_conv;
57230         this_arg_conv.inner = untag_ptr(this_arg);
57231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57233         this_arg_conv.is_owned = false;
57234         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
57235 }
57236
57237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57238         LDKNodeFeatures this_arg_conv;
57239         this_arg_conv.inner = untag_ptr(this_arg);
57240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57242         this_arg_conv.is_owned = false;
57243         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
57244         return ret_conv;
57245 }
57246
57247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57248         LDKChannelTypeFeatures this_arg_conv;
57249         this_arg_conv.inner = untag_ptr(this_arg);
57250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57252         this_arg_conv.is_owned = false;
57253         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
57254 }
57255
57256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57257         LDKChannelTypeFeatures this_arg_conv;
57258         this_arg_conv.inner = untag_ptr(this_arg);
57259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57261         this_arg_conv.is_owned = false;
57262         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
57263 }
57264
57265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57266         LDKChannelTypeFeatures this_arg_conv;
57267         this_arg_conv.inner = untag_ptr(this_arg);
57268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57270         this_arg_conv.is_owned = false;
57271         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
57272         return ret_conv;
57273 }
57274
57275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57276         LDKInitFeatures this_arg_conv;
57277         this_arg_conv.inner = untag_ptr(this_arg);
57278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57280         this_arg_conv.is_owned = false;
57281         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
57282         return ret_conv;
57283 }
57284
57285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57286         LDKNodeFeatures this_arg_conv;
57287         this_arg_conv.inner = untag_ptr(this_arg);
57288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57290         this_arg_conv.is_owned = false;
57291         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
57292         return ret_conv;
57293 }
57294
57295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57296         LDKChannelTypeFeatures this_arg_conv;
57297         this_arg_conv.inner = untag_ptr(this_arg);
57298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57300         this_arg_conv.is_owned = false;
57301         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
57302         return ret_conv;
57303 }
57304
57305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57306         LDKBolt11InvoiceFeatures this_arg_conv;
57307         this_arg_conv.inner = untag_ptr(this_arg);
57308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57310         this_arg_conv.is_owned = false;
57311         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
57312 }
57313
57314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57315         LDKBolt11InvoiceFeatures this_arg_conv;
57316         this_arg_conv.inner = untag_ptr(this_arg);
57317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57319         this_arg_conv.is_owned = false;
57320         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
57321 }
57322
57323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
57324         LDKBolt11InvoiceFeatures this_arg_conv;
57325         this_arg_conv.inner = untag_ptr(this_arg);
57326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57328         this_arg_conv.is_owned = false;
57329         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
57330         return ret_conv;
57331 }
57332
57333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
57334         LDKBolt11InvoiceFeatures this_arg_conv;
57335         this_arg_conv.inner = untag_ptr(this_arg);
57336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57338         this_arg_conv.is_owned = false;
57339         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
57340         return ret_conv;
57341 }
57342
57343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57344         LDKInitFeatures this_arg_conv;
57345         this_arg_conv.inner = untag_ptr(this_arg);
57346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57348         this_arg_conv.is_owned = false;
57349         InitFeatures_set_zero_conf_optional(&this_arg_conv);
57350 }
57351
57352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57353         LDKInitFeatures this_arg_conv;
57354         this_arg_conv.inner = untag_ptr(this_arg);
57355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57357         this_arg_conv.is_owned = false;
57358         InitFeatures_set_zero_conf_required(&this_arg_conv);
57359 }
57360
57361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57362         LDKInitFeatures this_arg_conv;
57363         this_arg_conv.inner = untag_ptr(this_arg);
57364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57366         this_arg_conv.is_owned = false;
57367         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
57368         return ret_conv;
57369 }
57370
57371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57372         LDKNodeFeatures this_arg_conv;
57373         this_arg_conv.inner = untag_ptr(this_arg);
57374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57376         this_arg_conv.is_owned = false;
57377         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
57378 }
57379
57380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57381         LDKNodeFeatures this_arg_conv;
57382         this_arg_conv.inner = untag_ptr(this_arg);
57383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57385         this_arg_conv.is_owned = false;
57386         NodeFeatures_set_zero_conf_required(&this_arg_conv);
57387 }
57388
57389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57390         LDKNodeFeatures this_arg_conv;
57391         this_arg_conv.inner = untag_ptr(this_arg);
57392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57394         this_arg_conv.is_owned = false;
57395         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
57396         return ret_conv;
57397 }
57398
57399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57400         LDKChannelTypeFeatures this_arg_conv;
57401         this_arg_conv.inner = untag_ptr(this_arg);
57402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57404         this_arg_conv.is_owned = false;
57405         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
57406 }
57407
57408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57409         LDKChannelTypeFeatures this_arg_conv;
57410         this_arg_conv.inner = untag_ptr(this_arg);
57411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57413         this_arg_conv.is_owned = false;
57414         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
57415 }
57416
57417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57418         LDKChannelTypeFeatures this_arg_conv;
57419         this_arg_conv.inner = untag_ptr(this_arg);
57420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57422         this_arg_conv.is_owned = false;
57423         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
57424         return ret_conv;
57425 }
57426
57427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57428         LDKInitFeatures this_arg_conv;
57429         this_arg_conv.inner = untag_ptr(this_arg);
57430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57432         this_arg_conv.is_owned = false;
57433         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
57434         return ret_conv;
57435 }
57436
57437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57438         LDKNodeFeatures this_arg_conv;
57439         this_arg_conv.inner = untag_ptr(this_arg);
57440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57442         this_arg_conv.is_owned = false;
57443         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
57444         return ret_conv;
57445 }
57446
57447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
57448         LDKChannelTypeFeatures this_arg_conv;
57449         this_arg_conv.inner = untag_ptr(this_arg);
57450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57452         this_arg_conv.is_owned = false;
57453         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
57454         return ret_conv;
57455 }
57456
57457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57458         LDKNodeFeatures this_arg_conv;
57459         this_arg_conv.inner = untag_ptr(this_arg);
57460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57462         this_arg_conv.is_owned = false;
57463         NodeFeatures_set_keysend_optional(&this_arg_conv);
57464 }
57465
57466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57467         LDKNodeFeatures this_arg_conv;
57468         this_arg_conv.inner = untag_ptr(this_arg);
57469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57471         this_arg_conv.is_owned = false;
57472         NodeFeatures_set_keysend_required(&this_arg_conv);
57473 }
57474
57475 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
57476         LDKNodeFeatures this_arg_conv;
57477         this_arg_conv.inner = untag_ptr(this_arg);
57478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57480         this_arg_conv.is_owned = false;
57481         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
57482         return ret_conv;
57483 }
57484
57485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
57486         LDKNodeFeatures this_arg_conv;
57487         this_arg_conv.inner = untag_ptr(this_arg);
57488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57490         this_arg_conv.is_owned = false;
57491         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
57492         return ret_conv;
57493 }
57494
57495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57496         LDKShutdownScript this_obj_conv;
57497         this_obj_conv.inner = untag_ptr(this_obj);
57498         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57500         ShutdownScript_free(this_obj_conv);
57501 }
57502
57503 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
57504         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
57505         int64_t ret_ref = 0;
57506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57508         return ret_ref;
57509 }
57510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57511         LDKShutdownScript arg_conv;
57512         arg_conv.inner = untag_ptr(arg);
57513         arg_conv.is_owned = ptr_is_owned(arg);
57514         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57515         arg_conv.is_owned = false;
57516         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
57517         return ret_conv;
57518 }
57519
57520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57521         LDKShutdownScript orig_conv;
57522         orig_conv.inner = untag_ptr(orig);
57523         orig_conv.is_owned = ptr_is_owned(orig);
57524         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57525         orig_conv.is_owned = false;
57526         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
57527         int64_t ret_ref = 0;
57528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57530         return ret_ref;
57531 }
57532
57533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57534         LDKShutdownScript a_conv;
57535         a_conv.inner = untag_ptr(a);
57536         a_conv.is_owned = ptr_is_owned(a);
57537         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57538         a_conv.is_owned = false;
57539         LDKShutdownScript b_conv;
57540         b_conv.inner = untag_ptr(b);
57541         b_conv.is_owned = ptr_is_owned(b);
57542         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57543         b_conv.is_owned = false;
57544         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
57545         return ret_conv;
57546 }
57547
57548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57549         LDKInvalidShutdownScript this_obj_conv;
57550         this_obj_conv.inner = untag_ptr(this_obj);
57551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57553         InvalidShutdownScript_free(this_obj_conv);
57554 }
57555
57556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
57557         LDKInvalidShutdownScript this_ptr_conv;
57558         this_ptr_conv.inner = untag_ptr(this_ptr);
57559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57561         this_ptr_conv.is_owned = false;
57562         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
57563         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57564         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57565         return ret_arr;
57566 }
57567
57568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57569         LDKInvalidShutdownScript this_ptr_conv;
57570         this_ptr_conv.inner = untag_ptr(this_ptr);
57571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57573         this_ptr_conv.is_owned = false;
57574         LDKCVec_u8Z val_ref;
57575         val_ref.datalen = (*env)->GetArrayLength(env, val);
57576         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
57577         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
57578         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
57579 }
57580
57581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
57582         LDKCVec_u8Z script_arg_ref;
57583         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
57584         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
57585         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
57586         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
57587         int64_t ret_ref = 0;
57588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57590         return ret_ref;
57591 }
57592
57593 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
57594         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
57595         int64_t ret_ref = 0;
57596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57598         return ret_ref;
57599 }
57600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57601         LDKInvalidShutdownScript arg_conv;
57602         arg_conv.inner = untag_ptr(arg);
57603         arg_conv.is_owned = ptr_is_owned(arg);
57604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57605         arg_conv.is_owned = false;
57606         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
57607         return ret_conv;
57608 }
57609
57610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57611         LDKInvalidShutdownScript orig_conv;
57612         orig_conv.inner = untag_ptr(orig);
57613         orig_conv.is_owned = ptr_is_owned(orig);
57614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57615         orig_conv.is_owned = false;
57616         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
57617         int64_t ret_ref = 0;
57618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57620         return ret_ref;
57621 }
57622
57623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
57624         LDKShutdownScript obj_conv;
57625         obj_conv.inner = untag_ptr(obj);
57626         obj_conv.is_owned = ptr_is_owned(obj);
57627         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57628         obj_conv.is_owned = false;
57629         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
57630         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57631         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57632         CVec_u8Z_free(ret_var);
57633         return ret_arr;
57634 }
57635
57636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57637         LDKu8slice ser_ref;
57638         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57639         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57640         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
57641         *ret_conv = ShutdownScript_read(ser_ref);
57642         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57643         return tag_ptr(ret_conv, true);
57644 }
57645
57646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
57647         uint8_t pubkey_hash_arr[20];
57648         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
57649         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
57650         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
57651         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
57652         int64_t ret_ref = 0;
57653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57655         return ret_ref;
57656 }
57657
57658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
57659         uint8_t script_hash_arr[32];
57660         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
57661         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
57662         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
57663         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
57664         int64_t ret_ref = 0;
57665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57667         return ret_ref;
57668 }
57669
57670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
57671         
57672         LDKu8slice program_ref;
57673         program_ref.datalen = (*env)->GetArrayLength(env, program);
57674         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
57675         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
57676         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
57677         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
57678         return tag_ptr(ret_conv, true);
57679 }
57680
57681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
57682         LDKShutdownScript this_arg_conv;
57683         this_arg_conv.inner = untag_ptr(this_arg);
57684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57686         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
57687         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
57688         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57689         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57690         CVec_u8Z_free(ret_var);
57691         return ret_arr;
57692 }
57693
57694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
57695         LDKShutdownScript this_arg_conv;
57696         this_arg_conv.inner = untag_ptr(this_arg);
57697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57699         this_arg_conv.is_owned = false;
57700         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
57701         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
57702         return ret_arr;
57703 }
57704
57705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
57706         LDKShutdownScript this_arg_conv;
57707         this_arg_conv.inner = untag_ptr(this_arg);
57708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57710         this_arg_conv.is_owned = false;
57711         LDKInitFeatures features_conv;
57712         features_conv.inner = untag_ptr(features);
57713         features_conv.is_owned = ptr_is_owned(features);
57714         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
57715         features_conv.is_owned = false;
57716         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
57717         return ret_conv;
57718 }
57719
57720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57721         if (!ptr_is_owned(this_ptr)) return;
57722         void* this_ptr_ptr = untag_ptr(this_ptr);
57723         CHECK_ACCESS(this_ptr_ptr);
57724         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
57725         FREE(untag_ptr(this_ptr));
57726         Retry_free(this_ptr_conv);
57727 }
57728
57729 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
57730         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
57731         *ret_copy = Retry_clone(arg);
57732         int64_t ret_ref = tag_ptr(ret_copy, true);
57733         return ret_ref;
57734 }
57735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57736         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
57737         int64_t ret_conv = Retry_clone_ptr(arg_conv);
57738         return ret_conv;
57739 }
57740
57741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57742         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
57743         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
57744         *ret_copy = Retry_clone(orig_conv);
57745         int64_t ret_ref = tag_ptr(ret_copy, true);
57746         return ret_ref;
57747 }
57748
57749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int32_t a) {
57750         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
57751         *ret_copy = Retry_attempts(a);
57752         int64_t ret_ref = tag_ptr(ret_copy, true);
57753         return ret_ref;
57754 }
57755
57756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
57757         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
57758         *ret_copy = Retry_timeout(a);
57759         int64_t ret_ref = tag_ptr(ret_copy, true);
57760         return ret_ref;
57761 }
57762
57763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57764         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
57765         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
57766         jboolean ret_conv = Retry_eq(a_conv, b_conv);
57767         return ret_conv;
57768 }
57769
57770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
57771         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
57772         int64_t ret_conv = Retry_hash(o_conv);
57773         return ret_conv;
57774 }
57775
57776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Retry_1write(JNIEnv *env, jclass clz, int64_t obj) {
57777         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
57778         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
57779         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57780         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57781         CVec_u8Z_free(ret_var);
57782         return ret_arr;
57783 }
57784
57785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57786         LDKu8slice ser_ref;
57787         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57788         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57789         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
57790         *ret_conv = Retry_read(ser_ref);
57791         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57792         return tag_ptr(ret_conv, true);
57793 }
57794
57795 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57796         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
57797         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
57798         return ret_conv;
57799 }
57800
57801 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
57802         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
57803         return ret_conv;
57804 }
57805
57806 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
57807         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
57808         return ret_conv;
57809 }
57810
57811 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
57812         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
57813         return ret_conv;
57814 }
57815
57816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57817         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
57818         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
57819         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
57820         return ret_conv;
57821 }
57822
57823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57824         if (!ptr_is_owned(this_ptr)) return;
57825         void* this_ptr_ptr = untag_ptr(this_ptr);
57826         CHECK_ACCESS(this_ptr_ptr);
57827         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
57828         FREE(untag_ptr(this_ptr));
57829         PaymentSendFailure_free(this_ptr_conv);
57830 }
57831
57832 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
57833         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57834         *ret_copy = PaymentSendFailure_clone(arg);
57835         int64_t ret_ref = tag_ptr(ret_copy, true);
57836         return ret_ref;
57837 }
57838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57839         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
57840         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
57841         return ret_conv;
57842 }
57843
57844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57845         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
57846         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57847         *ret_copy = PaymentSendFailure_clone(orig_conv);
57848         int64_t ret_ref = tag_ptr(ret_copy, true);
57849         return ret_ref;
57850 }
57851
57852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
57853         void* a_ptr = untag_ptr(a);
57854         CHECK_ACCESS(a_ptr);
57855         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
57856         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
57857         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57858         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
57859         int64_t ret_ref = tag_ptr(ret_copy, true);
57860         return ret_ref;
57861 }
57862
57863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
57864         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
57865         a_constr.datalen = (*env)->GetArrayLength(env, a);
57866         if (a_constr.datalen > 0)
57867                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
57868         else
57869                 a_constr.data = NULL;
57870         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
57871         for (size_t w = 0; w < a_constr.datalen; w++) {
57872                 int64_t a_conv_22 = a_vals[w];
57873                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
57874                 CHECK_ACCESS(a_conv_22_ptr);
57875                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
57876                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
57877                 a_constr.data[w] = a_conv_22_conv;
57878         }
57879         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
57880         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57881         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
57882         int64_t ret_ref = tag_ptr(ret_copy, true);
57883         return ret_ref;
57884 }
57885
57886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
57887         LDKCVec_APIErrorZ a_constr;
57888         a_constr.datalen = (*env)->GetArrayLength(env, a);
57889         if (a_constr.datalen > 0)
57890                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
57891         else
57892                 a_constr.data = NULL;
57893         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
57894         for (size_t k = 0; k < a_constr.datalen; k++) {
57895                 int64_t a_conv_10 = a_vals[k];
57896                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
57897                 CHECK_ACCESS(a_conv_10_ptr);
57898                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
57899                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
57900                 a_constr.data[k] = a_conv_10_conv;
57901         }
57902         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
57903         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57904         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
57905         int64_t ret_ref = tag_ptr(ret_copy, true);
57906         return ret_ref;
57907 }
57908
57909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
57910         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57911         *ret_copy = PaymentSendFailure_duplicate_payment();
57912         int64_t ret_ref = tag_ptr(ret_copy, true);
57913         return ret_ref;
57914 }
57915
57916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
57917         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
57918         results_constr.datalen = (*env)->GetArrayLength(env, results);
57919         if (results_constr.datalen > 0)
57920                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
57921         else
57922                 results_constr.data = NULL;
57923         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
57924         for (size_t w = 0; w < results_constr.datalen; w++) {
57925                 int64_t results_conv_22 = results_vals[w];
57926                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
57927                 CHECK_ACCESS(results_conv_22_ptr);
57928                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
57929                 results_constr.data[w] = results_conv_22_conv;
57930         }
57931         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
57932         LDKRouteParameters failed_paths_retry_conv;
57933         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
57934         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
57935         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
57936         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
57937         LDKThirtyTwoBytes payment_id_ref;
57938         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
57939         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
57940         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
57941         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
57942         int64_t ret_ref = tag_ptr(ret_copy, true);
57943         return ret_ref;
57944 }
57945
57946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57947         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
57948         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
57949         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
57950         return ret_conv;
57951 }
57952
57953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57954         if (!ptr_is_owned(this_ptr)) return;
57955         void* this_ptr_ptr = untag_ptr(this_ptr);
57956         CHECK_ACCESS(this_ptr_ptr);
57957         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
57958         FREE(untag_ptr(this_ptr));
57959         ProbeSendFailure_free(this_ptr_conv);
57960 }
57961
57962 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
57963         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
57964         *ret_copy = ProbeSendFailure_clone(arg);
57965         int64_t ret_ref = tag_ptr(ret_copy, true);
57966         return ret_ref;
57967 }
57968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57969         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
57970         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
57971         return ret_conv;
57972 }
57973
57974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57975         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
57976         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
57977         *ret_copy = ProbeSendFailure_clone(orig_conv);
57978         int64_t ret_ref = tag_ptr(ret_copy, true);
57979         return ret_ref;
57980 }
57981
57982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
57983         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
57984         *ret_copy = ProbeSendFailure_route_not_found();
57985         int64_t ret_ref = tag_ptr(ret_copy, true);
57986         return ret_ref;
57987 }
57988
57989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1sending_1failed(JNIEnv *env, jclass clz, int64_t a) {
57990         void* a_ptr = untag_ptr(a);
57991         CHECK_ACCESS(a_ptr);
57992         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
57993         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
57994         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
57995         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
57996         int64_t ret_ref = tag_ptr(ret_copy, true);
57997         return ret_ref;
57998 }
57999
58000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58001         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
58002         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
58003         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
58004         return ret_conv;
58005 }
58006
58007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58008         LDKRecipientOnionFields this_obj_conv;
58009         this_obj_conv.inner = untag_ptr(this_obj);
58010         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58012         RecipientOnionFields_free(this_obj_conv);
58013 }
58014
58015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
58016         LDKRecipientOnionFields this_ptr_conv;
58017         this_ptr_conv.inner = untag_ptr(this_ptr);
58018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58020         this_ptr_conv.is_owned = false;
58021         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
58022         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
58023         int64_t ret_ref = tag_ptr(ret_copy, true);
58024         return ret_ref;
58025 }
58026
58027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58028         LDKRecipientOnionFields this_ptr_conv;
58029         this_ptr_conv.inner = untag_ptr(this_ptr);
58030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58032         this_ptr_conv.is_owned = false;
58033         void* val_ptr = untag_ptr(val);
58034         CHECK_ACCESS(val_ptr);
58035         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
58036         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
58037         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
58038 }
58039
58040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
58041         LDKRecipientOnionFields this_ptr_conv;
58042         this_ptr_conv.inner = untag_ptr(this_ptr);
58043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58045         this_ptr_conv.is_owned = false;
58046         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58047         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
58048         int64_t ret_ref = tag_ptr(ret_copy, true);
58049         return ret_ref;
58050 }
58051
58052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58053         LDKRecipientOnionFields this_ptr_conv;
58054         this_ptr_conv.inner = untag_ptr(this_ptr);
58055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58057         this_ptr_conv.is_owned = false;
58058         void* val_ptr = untag_ptr(val);
58059         CHECK_ACCESS(val_ptr);
58060         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
58061         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
58062         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
58063 }
58064
58065 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
58066         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
58067         int64_t ret_ref = 0;
58068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58070         return ret_ref;
58071 }
58072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58073         LDKRecipientOnionFields arg_conv;
58074         arg_conv.inner = untag_ptr(arg);
58075         arg_conv.is_owned = ptr_is_owned(arg);
58076         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58077         arg_conv.is_owned = false;
58078         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
58079         return ret_conv;
58080 }
58081
58082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58083         LDKRecipientOnionFields orig_conv;
58084         orig_conv.inner = untag_ptr(orig);
58085         orig_conv.is_owned = ptr_is_owned(orig);
58086         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58087         orig_conv.is_owned = false;
58088         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
58089         int64_t ret_ref = 0;
58090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58092         return ret_ref;
58093 }
58094
58095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58096         LDKRecipientOnionFields a_conv;
58097         a_conv.inner = untag_ptr(a);
58098         a_conv.is_owned = ptr_is_owned(a);
58099         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58100         a_conv.is_owned = false;
58101         LDKRecipientOnionFields b_conv;
58102         b_conv.inner = untag_ptr(b);
58103         b_conv.is_owned = ptr_is_owned(b);
58104         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58105         b_conv.is_owned = false;
58106         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
58107         return ret_conv;
58108 }
58109
58110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
58111         LDKRecipientOnionFields obj_conv;
58112         obj_conv.inner = untag_ptr(obj);
58113         obj_conv.is_owned = ptr_is_owned(obj);
58114         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58115         obj_conv.is_owned = false;
58116         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
58117         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58118         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58119         CVec_u8Z_free(ret_var);
58120         return ret_arr;
58121 }
58122
58123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58124         LDKu8slice ser_ref;
58125         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58126         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58127         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
58128         *ret_conv = RecipientOnionFields_read(ser_ref);
58129         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58130         return tag_ptr(ret_conv, true);
58131 }
58132
58133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
58134         LDKThirtyTwoBytes payment_secret_ref;
58135         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
58136         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
58137         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
58138         int64_t ret_ref = 0;
58139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58141         return ret_ref;
58142 }
58143
58144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
58145         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
58146         int64_t ret_ref = 0;
58147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58149         return ret_ref;
58150 }
58151
58152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1with_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray custom_tlvs) {
58153         LDKRecipientOnionFields this_arg_conv;
58154         this_arg_conv.inner = untag_ptr(this_arg);
58155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58157         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
58158         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
58159         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
58160         if (custom_tlvs_constr.datalen > 0)
58161                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
58162         else
58163                 custom_tlvs_constr.data = NULL;
58164         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
58165         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
58166                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
58167                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
58168                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
58169                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
58170                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
58171                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
58172         }
58173         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
58174         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
58175         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
58176         return tag_ptr(ret_conv, true);
58177 }
58178
58179 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg) {
58180         LDKRecipientOnionFields this_arg_conv;
58181         this_arg_conv.inner = untag_ptr(this_arg);
58182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58184         this_arg_conv.is_owned = false;
58185         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
58186         int64_tArray ret_arr = NULL;
58187         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58188         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58189         for (size_t x = 0; x < ret_var.datalen; x++) {
58190                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
58191                 *ret_conv_23_conv = ret_var.data[x];
58192                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
58193         }
58194         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58195         FREE(ret_var.data);
58196         return ret_arr;
58197 }
58198
58199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58200         if (!ptr_is_owned(this_ptr)) return;
58201         void* this_ptr_ptr = untag_ptr(this_ptr);
58202         CHECK_ACCESS(this_ptr_ptr);
58203         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
58204         FREE(untag_ptr(this_ptr));
58205         CustomMessageReader_free(this_ptr_conv);
58206 }
58207
58208 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
58209         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58210         *ret_ret = Type_clone(arg);
58211         return tag_ptr(ret_ret, true);
58212 }
58213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58214         void* arg_ptr = untag_ptr(arg);
58215         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
58216         LDKType* arg_conv = (LDKType*)arg_ptr;
58217         int64_t ret_conv = Type_clone_ptr(arg_conv);
58218         return ret_conv;
58219 }
58220
58221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58222         void* orig_ptr = untag_ptr(orig);
58223         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
58224         LDKType* orig_conv = (LDKType*)orig_ptr;
58225         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58226         *ret_ret = Type_clone(orig_conv);
58227         return tag_ptr(ret_ret, true);
58228 }
58229
58230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58231         if (!ptr_is_owned(this_ptr)) return;
58232         void* this_ptr_ptr = untag_ptr(this_ptr);
58233         CHECK_ACCESS(this_ptr_ptr);
58234         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
58235         FREE(untag_ptr(this_ptr));
58236         Type_free(this_ptr_conv);
58237 }
58238
58239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58240         LDKOffer this_obj_conv;
58241         this_obj_conv.inner = untag_ptr(this_obj);
58242         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58244         Offer_free(this_obj_conv);
58245 }
58246
58247 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
58248         LDKOffer ret_var = Offer_clone(arg);
58249         int64_t ret_ref = 0;
58250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58252         return ret_ref;
58253 }
58254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58255         LDKOffer arg_conv;
58256         arg_conv.inner = untag_ptr(arg);
58257         arg_conv.is_owned = ptr_is_owned(arg);
58258         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58259         arg_conv.is_owned = false;
58260         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
58261         return ret_conv;
58262 }
58263
58264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58265         LDKOffer orig_conv;
58266         orig_conv.inner = untag_ptr(orig);
58267         orig_conv.is_owned = ptr_is_owned(orig);
58268         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58269         orig_conv.is_owned = false;
58270         LDKOffer ret_var = Offer_clone(&orig_conv);
58271         int64_t ret_ref = 0;
58272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58274         return ret_ref;
58275 }
58276
58277 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
58278         LDKOffer this_arg_conv;
58279         this_arg_conv.inner = untag_ptr(this_arg);
58280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58282         this_arg_conv.is_owned = false;
58283         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
58284         jobjectArray ret_arr = NULL;
58285         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
58286         ;
58287         for (size_t i = 0; i < ret_var.datalen; i++) {
58288                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
58289                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
58290                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
58291         }
58292         
58293         FREE(ret_var.data);
58294         return ret_arr;
58295 }
58296
58297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58298         LDKOffer this_arg_conv;
58299         this_arg_conv.inner = untag_ptr(this_arg);
58300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58302         this_arg_conv.is_owned = false;
58303         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58304         *ret_copy = Offer_metadata(&this_arg_conv);
58305         int64_t ret_ref = tag_ptr(ret_copy, true);
58306         return ret_ref;
58307 }
58308
58309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
58310         LDKOffer this_arg_conv;
58311         this_arg_conv.inner = untag_ptr(this_arg);
58312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58314         this_arg_conv.is_owned = false;
58315         LDKAmount ret_var = Offer_amount(&this_arg_conv);
58316         int64_t ret_ref = 0;
58317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58319         return ret_ref;
58320 }
58321
58322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
58323         LDKOffer this_arg_conv;
58324         this_arg_conv.inner = untag_ptr(this_arg);
58325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58327         this_arg_conv.is_owned = false;
58328         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
58329         int64_t ret_ref = 0;
58330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58332         return ret_ref;
58333 }
58334
58335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58336         LDKOffer this_arg_conv;
58337         this_arg_conv.inner = untag_ptr(this_arg);
58338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58340         this_arg_conv.is_owned = false;
58341         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
58342         int64_t ret_ref = 0;
58343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58345         return ret_ref;
58346 }
58347
58348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58349         LDKOffer this_arg_conv;
58350         this_arg_conv.inner = untag_ptr(this_arg);
58351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58353         this_arg_conv.is_owned = false;
58354         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58355         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
58356         int64_t ret_ref = tag_ptr(ret_copy, true);
58357         return ret_ref;
58358 }
58359
58360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
58361         LDKOffer this_arg_conv;
58362         this_arg_conv.inner = untag_ptr(this_arg);
58363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58365         this_arg_conv.is_owned = false;
58366         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
58367         int64_t ret_ref = 0;
58368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58370         return ret_ref;
58371 }
58372
58373 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
58374         LDKOffer this_arg_conv;
58375         this_arg_conv.inner = untag_ptr(this_arg);
58376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58378         this_arg_conv.is_owned = false;
58379         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
58380         int64_tArray ret_arr = NULL;
58381         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58382         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58383         for (size_t n = 0; n < ret_var.datalen; n++) {
58384                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
58385                 int64_t ret_conv_13_ref = 0;
58386                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
58387                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
58388                 ret_arr_ptr[n] = ret_conv_13_ref;
58389         }
58390         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58391         FREE(ret_var.data);
58392         return ret_arr;
58393 }
58394
58395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
58396         LDKOffer this_arg_conv;
58397         this_arg_conv.inner = untag_ptr(this_arg);
58398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58400         this_arg_conv.is_owned = false;
58401         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
58402         int64_t ret_ref = 0;
58403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58405         return ret_ref;
58406 }
58407
58408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
58409         LDKOffer this_arg_conv;
58410         this_arg_conv.inner = untag_ptr(this_arg);
58411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58413         this_arg_conv.is_owned = false;
58414         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58415         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
58416         return ret_arr;
58417 }
58418
58419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
58420         LDKOffer this_arg_conv;
58421         this_arg_conv.inner = untag_ptr(this_arg);
58422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58424         this_arg_conv.is_owned = false;
58425         LDKThirtyTwoBytes chain_ref;
58426         CHECK((*env)->GetArrayLength(env, chain) == 32);
58427         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
58428         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
58429         return ret_conv;
58430 }
58431
58432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
58433         LDKOffer this_arg_conv;
58434         this_arg_conv.inner = untag_ptr(this_arg);
58435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58437         this_arg_conv.is_owned = false;
58438         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
58439         return ret_conv;
58440 }
58441
58442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
58443         LDKOffer this_arg_conv;
58444         this_arg_conv.inner = untag_ptr(this_arg);
58445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58447         this_arg_conv.is_owned = false;
58448         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
58449         return ret_conv;
58450 }
58451
58452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
58453         LDKOffer this_arg_conv;
58454         this_arg_conv.inner = untag_ptr(this_arg);
58455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58457         this_arg_conv.is_owned = false;
58458         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
58459         return ret_conv;
58460 }
58461
58462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
58463         LDKOffer obj_conv;
58464         obj_conv.inner = untag_ptr(obj);
58465         obj_conv.is_owned = ptr_is_owned(obj);
58466         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58467         obj_conv.is_owned = false;
58468         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
58469         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58470         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58471         CVec_u8Z_free(ret_var);
58472         return ret_arr;
58473 }
58474
58475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58476         LDKAmount this_obj_conv;
58477         this_obj_conv.inner = untag_ptr(this_obj);
58478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58480         Amount_free(this_obj_conv);
58481 }
58482
58483 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
58484         LDKAmount ret_var = Amount_clone(arg);
58485         int64_t ret_ref = 0;
58486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58488         return ret_ref;
58489 }
58490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58491         LDKAmount arg_conv;
58492         arg_conv.inner = untag_ptr(arg);
58493         arg_conv.is_owned = ptr_is_owned(arg);
58494         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58495         arg_conv.is_owned = false;
58496         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
58497         return ret_conv;
58498 }
58499
58500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58501         LDKAmount orig_conv;
58502         orig_conv.inner = untag_ptr(orig);
58503         orig_conv.is_owned = ptr_is_owned(orig);
58504         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58505         orig_conv.is_owned = false;
58506         LDKAmount ret_var = Amount_clone(&orig_conv);
58507         int64_t ret_ref = 0;
58508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58510         return ret_ref;
58511 }
58512
58513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58514         LDKQuantity this_obj_conv;
58515         this_obj_conv.inner = untag_ptr(this_obj);
58516         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58518         Quantity_free(this_obj_conv);
58519 }
58520
58521 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
58522         LDKQuantity ret_var = Quantity_clone(arg);
58523         int64_t ret_ref = 0;
58524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58526         return ret_ref;
58527 }
58528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58529         LDKQuantity arg_conv;
58530         arg_conv.inner = untag_ptr(arg);
58531         arg_conv.is_owned = ptr_is_owned(arg);
58532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58533         arg_conv.is_owned = false;
58534         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
58535         return ret_conv;
58536 }
58537
58538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58539         LDKQuantity orig_conv;
58540         orig_conv.inner = untag_ptr(orig);
58541         orig_conv.is_owned = ptr_is_owned(orig);
58542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58543         orig_conv.is_owned = false;
58544         LDKQuantity ret_var = Quantity_clone(&orig_conv);
58545         int64_t ret_ref = 0;
58546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58548         return ret_ref;
58549 }
58550
58551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
58552         LDKStr s_conv = java_to_owned_str(env, s);
58553         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
58554         *ret_conv = Offer_from_str(s_conv);
58555         return tag_ptr(ret_conv, true);
58556 }
58557
58558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58559         LDKUnsignedBolt12Invoice this_obj_conv;
58560         this_obj_conv.inner = untag_ptr(this_obj);
58561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58563         UnsignedBolt12Invoice_free(this_obj_conv);
58564 }
58565
58566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
58567         LDKUnsignedBolt12Invoice this_arg_conv;
58568         this_arg_conv.inner = untag_ptr(this_arg);
58569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58571         this_arg_conv.is_owned = false;
58572         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
58573         int64_t ret_ref = 0;
58574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58576         return ret_ref;
58577 }
58578
58579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58580         LDKBolt12Invoice this_obj_conv;
58581         this_obj_conv.inner = untag_ptr(this_obj);
58582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58584         Bolt12Invoice_free(this_obj_conv);
58585 }
58586
58587 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
58588         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
58589         int64_t ret_ref = 0;
58590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58592         return ret_ref;
58593 }
58594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58595         LDKBolt12Invoice arg_conv;
58596         arg_conv.inner = untag_ptr(arg);
58597         arg_conv.is_owned = ptr_is_owned(arg);
58598         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58599         arg_conv.is_owned = false;
58600         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
58601         return ret_conv;
58602 }
58603
58604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58605         LDKBolt12Invoice orig_conv;
58606         orig_conv.inner = untag_ptr(orig);
58607         orig_conv.is_owned = ptr_is_owned(orig);
58608         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58609         orig_conv.is_owned = false;
58610         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
58611         int64_t ret_ref = 0;
58612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58614         return ret_ref;
58615 }
58616
58617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
58618         LDKUnsignedBolt12Invoice this_arg_conv;
58619         this_arg_conv.inner = untag_ptr(this_arg);
58620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58622         this_arg_conv.is_owned = false;
58623         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
58624         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
58625         int64_t ret_ref = tag_ptr(ret_copy, true);
58626         return ret_ref;
58627 }
58628
58629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
58630         LDKUnsignedBolt12Invoice this_arg_conv;
58631         this_arg_conv.inner = untag_ptr(this_arg);
58632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58634         this_arg_conv.is_owned = false;
58635         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58636         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_chain(&this_arg_conv).data);
58637         return ret_arr;
58638 }
58639
58640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58641         LDKUnsignedBolt12Invoice this_arg_conv;
58642         this_arg_conv.inner = untag_ptr(this_arg);
58643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58645         this_arg_conv.is_owned = false;
58646         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58647         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
58648         int64_t ret_ref = tag_ptr(ret_copy, true);
58649         return ret_ref;
58650 }
58651
58652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
58653         LDKUnsignedBolt12Invoice this_arg_conv;
58654         this_arg_conv.inner = untag_ptr(this_arg);
58655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58657         this_arg_conv.is_owned = false;
58658         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
58659         int64_t ret_ref = 0;
58660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58662         return ret_ref;
58663 }
58664
58665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58666         LDKUnsignedBolt12Invoice this_arg_conv;
58667         this_arg_conv.inner = untag_ptr(this_arg);
58668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58670         this_arg_conv.is_owned = false;
58671         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
58672         int64_t ret_ref = 0;
58673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58675         return ret_ref;
58676 }
58677
58678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
58679         LDKUnsignedBolt12Invoice this_arg_conv;
58680         this_arg_conv.inner = untag_ptr(this_arg);
58681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58683         this_arg_conv.is_owned = false;
58684         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
58685         int64_t ret_ref = 0;
58686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58688         return ret_ref;
58689 }
58690
58691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58692         LDKUnsignedBolt12Invoice this_arg_conv;
58693         this_arg_conv.inner = untag_ptr(this_arg);
58694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58696         this_arg_conv.is_owned = false;
58697         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58698         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
58699         int64_t ret_ref = tag_ptr(ret_copy, true);
58700         return ret_ref;
58701 }
58702
58703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
58704         LDKUnsignedBolt12Invoice this_arg_conv;
58705         this_arg_conv.inner = untag_ptr(this_arg);
58706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58708         this_arg_conv.is_owned = false;
58709         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
58710         int64_t ret_ref = 0;
58711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58713         return ret_ref;
58714 }
58715
58716 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
58717         LDKUnsignedBolt12Invoice this_arg_conv;
58718         this_arg_conv.inner = untag_ptr(this_arg);
58719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58721         this_arg_conv.is_owned = false;
58722         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
58723         int64_tArray ret_arr = NULL;
58724         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58725         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58726         for (size_t n = 0; n < ret_var.datalen; n++) {
58727                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
58728                 int64_t ret_conv_13_ref = 0;
58729                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
58730                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
58731                 ret_arr_ptr[n] = ret_conv_13_ref;
58732         }
58733         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58734         FREE(ret_var.data);
58735         return ret_arr;
58736 }
58737
58738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
58739         LDKUnsignedBolt12Invoice this_arg_conv;
58740         this_arg_conv.inner = untag_ptr(this_arg);
58741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58743         this_arg_conv.is_owned = false;
58744         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
58745         int64_t ret_ref = 0;
58746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58748         return ret_ref;
58749 }
58750
58751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58752         LDKUnsignedBolt12Invoice this_arg_conv;
58753         this_arg_conv.inner = untag_ptr(this_arg);
58754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58756         this_arg_conv.is_owned = false;
58757         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
58758         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58759         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58760         return ret_arr;
58761 }
58762
58763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58764         LDKUnsignedBolt12Invoice this_arg_conv;
58765         this_arg_conv.inner = untag_ptr(this_arg);
58766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58768         this_arg_conv.is_owned = false;
58769         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
58770         int64_t ret_ref = 0;
58771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58773         return ret_ref;
58774 }
58775
58776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
58777         LDKUnsignedBolt12Invoice this_arg_conv;
58778         this_arg_conv.inner = untag_ptr(this_arg);
58779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58781         this_arg_conv.is_owned = false;
58782         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58783         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
58784         int64_t ret_ref = tag_ptr(ret_copy, true);
58785         return ret_ref;
58786 }
58787
58788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
58789         LDKUnsignedBolt12Invoice this_arg_conv;
58790         this_arg_conv.inner = untag_ptr(this_arg);
58791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58793         this_arg_conv.is_owned = false;
58794         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58795         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form);
58796         return ret_arr;
58797 }
58798
58799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
58800         LDKUnsignedBolt12Invoice this_arg_conv;
58801         this_arg_conv.inner = untag_ptr(this_arg);
58802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58804         this_arg_conv.is_owned = false;
58805         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
58806         int64_t ret_ref = 0;
58807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58809         return ret_ref;
58810 }
58811
58812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
58813         LDKUnsignedBolt12Invoice this_arg_conv;
58814         this_arg_conv.inner = untag_ptr(this_arg);
58815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58817         this_arg_conv.is_owned = false;
58818         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
58819         return ret_conv;
58820 }
58821
58822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58823         LDKUnsignedBolt12Invoice this_arg_conv;
58824         this_arg_conv.inner = untag_ptr(this_arg);
58825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58827         this_arg_conv.is_owned = false;
58828         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
58829         return ret_conv;
58830 }
58831
58832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
58833         LDKUnsignedBolt12Invoice this_arg_conv;
58834         this_arg_conv.inner = untag_ptr(this_arg);
58835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58837         this_arg_conv.is_owned = false;
58838         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
58839         return ret_conv;
58840 }
58841
58842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
58843         LDKUnsignedBolt12Invoice this_arg_conv;
58844         this_arg_conv.inner = untag_ptr(this_arg);
58845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58847         this_arg_conv.is_owned = false;
58848         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58849         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data);
58850         return ret_arr;
58851 }
58852
58853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
58854         LDKUnsignedBolt12Invoice this_arg_conv;
58855         this_arg_conv.inner = untag_ptr(this_arg);
58856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58858         this_arg_conv.is_owned = false;
58859         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
58860         return ret_conv;
58861 }
58862
58863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58864         LDKUnsignedBolt12Invoice this_arg_conv;
58865         this_arg_conv.inner = untag_ptr(this_arg);
58866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58868         this_arg_conv.is_owned = false;
58869         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
58870         int64_t ret_ref = 0;
58871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58873         return ret_ref;
58874 }
58875
58876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
58877         LDKUnsignedBolt12Invoice this_arg_conv;
58878         this_arg_conv.inner = untag_ptr(this_arg);
58879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58881         this_arg_conv.is_owned = false;
58882         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58883         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
58884         return ret_arr;
58885 }
58886
58887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
58888         LDKBolt12Invoice this_arg_conv;
58889         this_arg_conv.inner = untag_ptr(this_arg);
58890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58892         this_arg_conv.is_owned = false;
58893         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
58894         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
58895         int64_t ret_ref = tag_ptr(ret_copy, true);
58896         return ret_ref;
58897 }
58898
58899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
58900         LDKBolt12Invoice this_arg_conv;
58901         this_arg_conv.inner = untag_ptr(this_arg);
58902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58904         this_arg_conv.is_owned = false;
58905         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58906         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_chain(&this_arg_conv).data);
58907         return ret_arr;
58908 }
58909
58910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58911         LDKBolt12Invoice this_arg_conv;
58912         this_arg_conv.inner = untag_ptr(this_arg);
58913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58915         this_arg_conv.is_owned = false;
58916         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58917         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
58918         int64_t ret_ref = tag_ptr(ret_copy, true);
58919         return ret_ref;
58920 }
58921
58922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
58923         LDKBolt12Invoice this_arg_conv;
58924         this_arg_conv.inner = untag_ptr(this_arg);
58925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58927         this_arg_conv.is_owned = false;
58928         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
58929         int64_t ret_ref = 0;
58930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58932         return ret_ref;
58933 }
58934
58935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58936         LDKBolt12Invoice this_arg_conv;
58937         this_arg_conv.inner = untag_ptr(this_arg);
58938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58940         this_arg_conv.is_owned = false;
58941         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
58942         int64_t ret_ref = 0;
58943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58945         return ret_ref;
58946 }
58947
58948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
58949         LDKBolt12Invoice this_arg_conv;
58950         this_arg_conv.inner = untag_ptr(this_arg);
58951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58953         this_arg_conv.is_owned = false;
58954         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
58955         int64_t ret_ref = 0;
58956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58958         return ret_ref;
58959 }
58960
58961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58962         LDKBolt12Invoice this_arg_conv;
58963         this_arg_conv.inner = untag_ptr(this_arg);
58964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58966         this_arg_conv.is_owned = false;
58967         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58968         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
58969         int64_t ret_ref = tag_ptr(ret_copy, true);
58970         return ret_ref;
58971 }
58972
58973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
58974         LDKBolt12Invoice this_arg_conv;
58975         this_arg_conv.inner = untag_ptr(this_arg);
58976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58978         this_arg_conv.is_owned = false;
58979         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
58980         int64_t ret_ref = 0;
58981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58983         return ret_ref;
58984 }
58985
58986 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
58987         LDKBolt12Invoice this_arg_conv;
58988         this_arg_conv.inner = untag_ptr(this_arg);
58989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58991         this_arg_conv.is_owned = false;
58992         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
58993         int64_tArray ret_arr = NULL;
58994         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58995         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58996         for (size_t n = 0; n < ret_var.datalen; n++) {
58997                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
58998                 int64_t ret_conv_13_ref = 0;
58999                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59000                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59001                 ret_arr_ptr[n] = ret_conv_13_ref;
59002         }
59003         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59004         FREE(ret_var.data);
59005         return ret_arr;
59006 }
59007
59008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59009         LDKBolt12Invoice this_arg_conv;
59010         this_arg_conv.inner = untag_ptr(this_arg);
59011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59013         this_arg_conv.is_owned = false;
59014         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
59015         int64_t ret_ref = 0;
59016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59018         return ret_ref;
59019 }
59020
59021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59022         LDKBolt12Invoice this_arg_conv;
59023         this_arg_conv.inner = untag_ptr(this_arg);
59024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59026         this_arg_conv.is_owned = false;
59027         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
59028         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59029         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59030         return ret_arr;
59031 }
59032
59033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59034         LDKBolt12Invoice this_arg_conv;
59035         this_arg_conv.inner = untag_ptr(this_arg);
59036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59038         this_arg_conv.is_owned = false;
59039         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
59040         int64_t ret_ref = 0;
59041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59043         return ret_ref;
59044 }
59045
59046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59047         LDKBolt12Invoice this_arg_conv;
59048         this_arg_conv.inner = untag_ptr(this_arg);
59049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59051         this_arg_conv.is_owned = false;
59052         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59053         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
59054         int64_t ret_ref = tag_ptr(ret_copy, true);
59055         return ret_ref;
59056 }
59057
59058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
59059         LDKBolt12Invoice this_arg_conv;
59060         this_arg_conv.inner = untag_ptr(this_arg);
59061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59063         this_arg_conv.is_owned = false;
59064         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59065         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form);
59066         return ret_arr;
59067 }
59068
59069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
59070         LDKBolt12Invoice this_arg_conv;
59071         this_arg_conv.inner = untag_ptr(this_arg);
59072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59074         this_arg_conv.is_owned = false;
59075         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
59076         int64_t ret_ref = 0;
59077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59079         return ret_ref;
59080 }
59081
59082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
59083         LDKBolt12Invoice this_arg_conv;
59084         this_arg_conv.inner = untag_ptr(this_arg);
59085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59087         this_arg_conv.is_owned = false;
59088         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
59089         return ret_conv;
59090 }
59091
59092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59093         LDKBolt12Invoice this_arg_conv;
59094         this_arg_conv.inner = untag_ptr(this_arg);
59095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59097         this_arg_conv.is_owned = false;
59098         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
59099         return ret_conv;
59100 }
59101
59102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
59103         LDKBolt12Invoice this_arg_conv;
59104         this_arg_conv.inner = untag_ptr(this_arg);
59105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59107         this_arg_conv.is_owned = false;
59108         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
59109         return ret_conv;
59110 }
59111
59112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59113         LDKBolt12Invoice this_arg_conv;
59114         this_arg_conv.inner = untag_ptr(this_arg);
59115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59117         this_arg_conv.is_owned = false;
59118         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59119         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
59120         return ret_arr;
59121 }
59122
59123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
59124         LDKBolt12Invoice this_arg_conv;
59125         this_arg_conv.inner = untag_ptr(this_arg);
59126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59128         this_arg_conv.is_owned = false;
59129         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
59130         return ret_conv;
59131 }
59132
59133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59134         LDKBolt12Invoice this_arg_conv;
59135         this_arg_conv.inner = untag_ptr(this_arg);
59136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59138         this_arg_conv.is_owned = false;
59139         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
59140         int64_t ret_ref = 0;
59141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59143         return ret_ref;
59144 }
59145
59146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59147         LDKBolt12Invoice this_arg_conv;
59148         this_arg_conv.inner = untag_ptr(this_arg);
59149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59151         this_arg_conv.is_owned = false;
59152         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59153         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
59154         return ret_arr;
59155 }
59156
59157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
59158         LDKBolt12Invoice this_arg_conv;
59159         this_arg_conv.inner = untag_ptr(this_arg);
59160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59162         this_arg_conv.is_owned = false;
59163         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59164         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, Bolt12Invoice_signature(&this_arg_conv).compact_form);
59165         return ret_arr;
59166 }
59167
59168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59169         LDKBolt12Invoice this_arg_conv;
59170         this_arg_conv.inner = untag_ptr(this_arg);
59171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59173         this_arg_conv.is_owned = false;
59174         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59175         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
59176         return ret_arr;
59177 }
59178
59179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
59180         LDKBolt12Invoice this_arg_conv;
59181         this_arg_conv.inner = untag_ptr(this_arg);
59182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59184         this_arg_conv.is_owned = false;
59185         LDKExpandedKey key_conv;
59186         key_conv.inner = untag_ptr(key);
59187         key_conv.is_owned = ptr_is_owned(key);
59188         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
59189         key_conv.is_owned = false;
59190         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
59191         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
59192         return tag_ptr(ret_conv, true);
59193 }
59194
59195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
59196         LDKUnsignedBolt12Invoice obj_conv;
59197         obj_conv.inner = untag_ptr(obj);
59198         obj_conv.is_owned = ptr_is_owned(obj);
59199         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59200         obj_conv.is_owned = false;
59201         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
59202         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59203         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59204         CVec_u8Z_free(ret_var);
59205         return ret_arr;
59206 }
59207
59208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
59209         LDKBolt12Invoice obj_conv;
59210         obj_conv.inner = untag_ptr(obj);
59211         obj_conv.is_owned = ptr_is_owned(obj);
59212         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59213         obj_conv.is_owned = false;
59214         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
59215         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59216         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59217         CVec_u8Z_free(ret_var);
59218         return ret_arr;
59219 }
59220
59221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59222         LDKBlindedPayInfo this_obj_conv;
59223         this_obj_conv.inner = untag_ptr(this_obj);
59224         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59226         BlindedPayInfo_free(this_obj_conv);
59227 }
59228
59229 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59230         LDKBlindedPayInfo this_ptr_conv;
59231         this_ptr_conv.inner = untag_ptr(this_ptr);
59232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59234         this_ptr_conv.is_owned = false;
59235         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
59236         return ret_conv;
59237 }
59238
59239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59240         LDKBlindedPayInfo this_ptr_conv;
59241         this_ptr_conv.inner = untag_ptr(this_ptr);
59242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59244         this_ptr_conv.is_owned = false;
59245         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
59246 }
59247
59248 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
59249         LDKBlindedPayInfo this_ptr_conv;
59250         this_ptr_conv.inner = untag_ptr(this_ptr);
59251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59253         this_ptr_conv.is_owned = false;
59254         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
59255         return ret_conv;
59256 }
59257
59258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59259         LDKBlindedPayInfo this_ptr_conv;
59260         this_ptr_conv.inner = untag_ptr(this_ptr);
59261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59263         this_ptr_conv.is_owned = false;
59264         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
59265 }
59266
59267 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
59268         LDKBlindedPayInfo this_ptr_conv;
59269         this_ptr_conv.inner = untag_ptr(this_ptr);
59270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59272         this_ptr_conv.is_owned = false;
59273         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
59274         return ret_conv;
59275 }
59276
59277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
59278         LDKBlindedPayInfo this_ptr_conv;
59279         this_ptr_conv.inner = untag_ptr(this_ptr);
59280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59282         this_ptr_conv.is_owned = false;
59283         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
59284 }
59285
59286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59287         LDKBlindedPayInfo this_ptr_conv;
59288         this_ptr_conv.inner = untag_ptr(this_ptr);
59289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59291         this_ptr_conv.is_owned = false;
59292         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
59293         return ret_conv;
59294 }
59295
59296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59297         LDKBlindedPayInfo this_ptr_conv;
59298         this_ptr_conv.inner = untag_ptr(this_ptr);
59299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59301         this_ptr_conv.is_owned = false;
59302         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
59303 }
59304
59305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59306         LDKBlindedPayInfo this_ptr_conv;
59307         this_ptr_conv.inner = untag_ptr(this_ptr);
59308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59310         this_ptr_conv.is_owned = false;
59311         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
59312         return ret_conv;
59313 }
59314
59315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59316         LDKBlindedPayInfo this_ptr_conv;
59317         this_ptr_conv.inner = untag_ptr(this_ptr);
59318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59320         this_ptr_conv.is_owned = false;
59321         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
59322 }
59323
59324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59325         LDKBlindedPayInfo this_ptr_conv;
59326         this_ptr_conv.inner = untag_ptr(this_ptr);
59327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59329         this_ptr_conv.is_owned = false;
59330         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
59331         int64_t ret_ref = 0;
59332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59334         return ret_ref;
59335 }
59336
59337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59338         LDKBlindedPayInfo this_ptr_conv;
59339         this_ptr_conv.inner = untag_ptr(this_ptr);
59340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59342         this_ptr_conv.is_owned = false;
59343         LDKBlindedHopFeatures val_conv;
59344         val_conv.inner = untag_ptr(val);
59345         val_conv.is_owned = ptr_is_owned(val);
59346         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59347         val_conv = BlindedHopFeatures_clone(&val_conv);
59348         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
59349 }
59350
59351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t features_arg) {
59352         LDKBlindedHopFeatures features_arg_conv;
59353         features_arg_conv.inner = untag_ptr(features_arg);
59354         features_arg_conv.is_owned = ptr_is_owned(features_arg);
59355         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
59356         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
59357         LDKBlindedPayInfo ret_var = BlindedPayInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, features_arg_conv);
59358         int64_t ret_ref = 0;
59359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59361         return ret_ref;
59362 }
59363
59364 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
59365         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
59366         int64_t ret_ref = 0;
59367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59369         return ret_ref;
59370 }
59371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59372         LDKBlindedPayInfo arg_conv;
59373         arg_conv.inner = untag_ptr(arg);
59374         arg_conv.is_owned = ptr_is_owned(arg);
59375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59376         arg_conv.is_owned = false;
59377         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
59378         return ret_conv;
59379 }
59380
59381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59382         LDKBlindedPayInfo orig_conv;
59383         orig_conv.inner = untag_ptr(orig);
59384         orig_conv.is_owned = ptr_is_owned(orig);
59385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59386         orig_conv.is_owned = false;
59387         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
59388         int64_t ret_ref = 0;
59389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59391         return ret_ref;
59392 }
59393
59394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
59395         LDKBlindedPayInfo o_conv;
59396         o_conv.inner = untag_ptr(o);
59397         o_conv.is_owned = ptr_is_owned(o);
59398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59399         o_conv.is_owned = false;
59400         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
59401         return ret_conv;
59402 }
59403
59404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59405         LDKBlindedPayInfo a_conv;
59406         a_conv.inner = untag_ptr(a);
59407         a_conv.is_owned = ptr_is_owned(a);
59408         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59409         a_conv.is_owned = false;
59410         LDKBlindedPayInfo b_conv;
59411         b_conv.inner = untag_ptr(b);
59412         b_conv.is_owned = ptr_is_owned(b);
59413         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59414         b_conv.is_owned = false;
59415         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
59416         return ret_conv;
59417 }
59418
59419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
59420         LDKBlindedPayInfo obj_conv;
59421         obj_conv.inner = untag_ptr(obj);
59422         obj_conv.is_owned = ptr_is_owned(obj);
59423         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59424         obj_conv.is_owned = false;
59425         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
59426         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59427         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59428         CVec_u8Z_free(ret_var);
59429         return ret_arr;
59430 }
59431
59432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59433         LDKu8slice ser_ref;
59434         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59435         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59436         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
59437         *ret_conv = BlindedPayInfo_read(ser_ref);
59438         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59439         return tag_ptr(ret_conv, true);
59440 }
59441
59442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59443         LDKInvoiceError this_obj_conv;
59444         this_obj_conv.inner = untag_ptr(this_obj);
59445         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59447         InvoiceError_free(this_obj_conv);
59448 }
59449
59450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
59451         LDKInvoiceError this_ptr_conv;
59452         this_ptr_conv.inner = untag_ptr(this_ptr);
59453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59455         this_ptr_conv.is_owned = false;
59456         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
59457         int64_t ret_ref = 0;
59458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59460         return ret_ref;
59461 }
59462
59463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59464         LDKInvoiceError this_ptr_conv;
59465         this_ptr_conv.inner = untag_ptr(this_ptr);
59466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59468         this_ptr_conv.is_owned = false;
59469         LDKErroneousField val_conv;
59470         val_conv.inner = untag_ptr(val);
59471         val_conv.is_owned = ptr_is_owned(val);
59472         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59473         val_conv = ErroneousField_clone(&val_conv);
59474         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
59475 }
59476
59477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
59478         LDKInvoiceError this_ptr_conv;
59479         this_ptr_conv.inner = untag_ptr(this_ptr);
59480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59482         this_ptr_conv.is_owned = false;
59483         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
59484         int64_t ret_ref = 0;
59485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59487         return ret_ref;
59488 }
59489
59490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59491         LDKInvoiceError this_ptr_conv;
59492         this_ptr_conv.inner = untag_ptr(this_ptr);
59493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59495         this_ptr_conv.is_owned = false;
59496         LDKUntrustedString val_conv;
59497         val_conv.inner = untag_ptr(val);
59498         val_conv.is_owned = ptr_is_owned(val);
59499         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59500         val_conv = UntrustedString_clone(&val_conv);
59501         InvoiceError_set_message(&this_ptr_conv, val_conv);
59502 }
59503
59504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
59505         LDKErroneousField erroneous_field_arg_conv;
59506         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
59507         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
59508         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
59509         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
59510         LDKUntrustedString message_arg_conv;
59511         message_arg_conv.inner = untag_ptr(message_arg);
59512         message_arg_conv.is_owned = ptr_is_owned(message_arg);
59513         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
59514         message_arg_conv = UntrustedString_clone(&message_arg_conv);
59515         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
59516         int64_t ret_ref = 0;
59517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59519         return ret_ref;
59520 }
59521
59522 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
59523         LDKInvoiceError ret_var = InvoiceError_clone(arg);
59524         int64_t ret_ref = 0;
59525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59527         return ret_ref;
59528 }
59529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59530         LDKInvoiceError arg_conv;
59531         arg_conv.inner = untag_ptr(arg);
59532         arg_conv.is_owned = ptr_is_owned(arg);
59533         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59534         arg_conv.is_owned = false;
59535         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
59536         return ret_conv;
59537 }
59538
59539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59540         LDKInvoiceError orig_conv;
59541         orig_conv.inner = untag_ptr(orig);
59542         orig_conv.is_owned = ptr_is_owned(orig);
59543         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59544         orig_conv.is_owned = false;
59545         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
59546         int64_t ret_ref = 0;
59547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59549         return ret_ref;
59550 }
59551
59552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59553         LDKErroneousField this_obj_conv;
59554         this_obj_conv.inner = untag_ptr(this_obj);
59555         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59557         ErroneousField_free(this_obj_conv);
59558 }
59559
59560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
59561         LDKErroneousField this_ptr_conv;
59562         this_ptr_conv.inner = untag_ptr(this_ptr);
59563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59565         this_ptr_conv.is_owned = false;
59566         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
59567         return ret_conv;
59568 }
59569
59570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59571         LDKErroneousField this_ptr_conv;
59572         this_ptr_conv.inner = untag_ptr(this_ptr);
59573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59575         this_ptr_conv.is_owned = false;
59576         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
59577 }
59578
59579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
59580         LDKErroneousField this_ptr_conv;
59581         this_ptr_conv.inner = untag_ptr(this_ptr);
59582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59584         this_ptr_conv.is_owned = false;
59585         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59586         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
59587         int64_t ret_ref = tag_ptr(ret_copy, true);
59588         return ret_ref;
59589 }
59590
59591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59592         LDKErroneousField this_ptr_conv;
59593         this_ptr_conv.inner = untag_ptr(this_ptr);
59594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59596         this_ptr_conv.is_owned = false;
59597         void* val_ptr = untag_ptr(val);
59598         CHECK_ACCESS(val_ptr);
59599         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
59600         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
59601         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
59602 }
59603
59604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1new(JNIEnv *env, jclass clz, int64_t tlv_fieldnum_arg, int64_t suggested_value_arg) {
59605         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
59606         CHECK_ACCESS(suggested_value_arg_ptr);
59607         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
59608         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
59609         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
59610         int64_t ret_ref = 0;
59611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59613         return ret_ref;
59614 }
59615
59616 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
59617         LDKErroneousField ret_var = ErroneousField_clone(arg);
59618         int64_t ret_ref = 0;
59619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59621         return ret_ref;
59622 }
59623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59624         LDKErroneousField arg_conv;
59625         arg_conv.inner = untag_ptr(arg);
59626         arg_conv.is_owned = ptr_is_owned(arg);
59627         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59628         arg_conv.is_owned = false;
59629         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
59630         return ret_conv;
59631 }
59632
59633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59634         LDKErroneousField orig_conv;
59635         orig_conv.inner = untag_ptr(orig);
59636         orig_conv.is_owned = ptr_is_owned(orig);
59637         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59638         orig_conv.is_owned = false;
59639         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
59640         int64_t ret_ref = 0;
59641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59643         return ret_ref;
59644 }
59645
59646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
59647         LDKInvoiceError obj_conv;
59648         obj_conv.inner = untag_ptr(obj);
59649         obj_conv.is_owned = ptr_is_owned(obj);
59650         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59651         obj_conv.is_owned = false;
59652         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
59653         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59654         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59655         CVec_u8Z_free(ret_var);
59656         return ret_arr;
59657 }
59658
59659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59660         LDKu8slice ser_ref;
59661         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59662         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59663         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
59664         *ret_conv = InvoiceError_read(ser_ref);
59665         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59666         return tag_ptr(ret_conv, true);
59667 }
59668
59669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59670         LDKUnsignedInvoiceRequest this_obj_conv;
59671         this_obj_conv.inner = untag_ptr(this_obj);
59672         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59674         UnsignedInvoiceRequest_free(this_obj_conv);
59675 }
59676
59677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59678         LDKUnsignedInvoiceRequest this_arg_conv;
59679         this_arg_conv.inner = untag_ptr(this_arg);
59680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59682         this_arg_conv.is_owned = false;
59683         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
59684         int64_t ret_ref = 0;
59685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59687         return ret_ref;
59688 }
59689
59690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59691         LDKInvoiceRequest this_obj_conv;
59692         this_obj_conv.inner = untag_ptr(this_obj);
59693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59695         InvoiceRequest_free(this_obj_conv);
59696 }
59697
59698 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
59699         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
59700         int64_t ret_ref = 0;
59701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59703         return ret_ref;
59704 }
59705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59706         LDKInvoiceRequest arg_conv;
59707         arg_conv.inner = untag_ptr(arg);
59708         arg_conv.is_owned = ptr_is_owned(arg);
59709         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59710         arg_conv.is_owned = false;
59711         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
59712         return ret_conv;
59713 }
59714
59715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59716         LDKInvoiceRequest orig_conv;
59717         orig_conv.inner = untag_ptr(orig);
59718         orig_conv.is_owned = ptr_is_owned(orig);
59719         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59720         orig_conv.is_owned = false;
59721         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
59722         int64_t ret_ref = 0;
59723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59725         return ret_ref;
59726 }
59727
59728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59729         LDKVerifiedInvoiceRequest this_obj_conv;
59730         this_obj_conv.inner = untag_ptr(this_obj);
59731         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59733         VerifiedInvoiceRequest_free(this_obj_conv);
59734 }
59735
59736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1keys(JNIEnv *env, jclass clz, int64_t this_ptr) {
59737         LDKVerifiedInvoiceRequest this_ptr_conv;
59738         this_ptr_conv.inner = untag_ptr(this_ptr);
59739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59741         this_ptr_conv.is_owned = false;
59742         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
59743         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
59744         int64_t ret_ref = tag_ptr(ret_copy, true);
59745         return ret_ref;
59746 }
59747
59748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1keys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59749         LDKVerifiedInvoiceRequest this_ptr_conv;
59750         this_ptr_conv.inner = untag_ptr(this_ptr);
59751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59753         this_ptr_conv.is_owned = false;
59754         void* val_ptr = untag_ptr(val);
59755         CHECK_ACCESS(val_ptr);
59756         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
59757         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
59758         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
59759 }
59760
59761 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
59762         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
59763         int64_t ret_ref = 0;
59764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59766         return ret_ref;
59767 }
59768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59769         LDKVerifiedInvoiceRequest arg_conv;
59770         arg_conv.inner = untag_ptr(arg);
59771         arg_conv.is_owned = ptr_is_owned(arg);
59772         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59773         arg_conv.is_owned = false;
59774         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
59775         return ret_conv;
59776 }
59777
59778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59779         LDKVerifiedInvoiceRequest orig_conv;
59780         orig_conv.inner = untag_ptr(orig);
59781         orig_conv.is_owned = ptr_is_owned(orig);
59782         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59783         orig_conv.is_owned = false;
59784         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
59785         int64_t ret_ref = 0;
59786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59788         return ret_ref;
59789 }
59790
59791 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
59792         LDKUnsignedInvoiceRequest this_arg_conv;
59793         this_arg_conv.inner = untag_ptr(this_arg);
59794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59796         this_arg_conv.is_owned = false;
59797         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
59798         jobjectArray ret_arr = NULL;
59799         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
59800         ;
59801         for (size_t i = 0; i < ret_var.datalen; i++) {
59802                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
59803                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
59804                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
59805         }
59806         
59807         FREE(ret_var.data);
59808         return ret_arr;
59809 }
59810
59811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59812         LDKUnsignedInvoiceRequest this_arg_conv;
59813         this_arg_conv.inner = untag_ptr(this_arg);
59814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59816         this_arg_conv.is_owned = false;
59817         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59818         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
59819         int64_t ret_ref = tag_ptr(ret_copy, true);
59820         return ret_ref;
59821 }
59822
59823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
59824         LDKUnsignedInvoiceRequest this_arg_conv;
59825         this_arg_conv.inner = untag_ptr(this_arg);
59826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59828         this_arg_conv.is_owned = false;
59829         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
59830         int64_t ret_ref = 0;
59831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59833         return ret_ref;
59834 }
59835
59836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
59837         LDKUnsignedInvoiceRequest this_arg_conv;
59838         this_arg_conv.inner = untag_ptr(this_arg);
59839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59841         this_arg_conv.is_owned = false;
59842         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
59843         int64_t ret_ref = 0;
59844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59846         return ret_ref;
59847 }
59848
59849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59850         LDKUnsignedInvoiceRequest this_arg_conv;
59851         this_arg_conv.inner = untag_ptr(this_arg);
59852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59854         this_arg_conv.is_owned = false;
59855         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
59856         int64_t ret_ref = 0;
59857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59859         return ret_ref;
59860 }
59861
59862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59863         LDKUnsignedInvoiceRequest this_arg_conv;
59864         this_arg_conv.inner = untag_ptr(this_arg);
59865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59867         this_arg_conv.is_owned = false;
59868         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59869         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
59870         int64_t ret_ref = tag_ptr(ret_copy, true);
59871         return ret_ref;
59872 }
59873
59874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
59875         LDKUnsignedInvoiceRequest this_arg_conv;
59876         this_arg_conv.inner = untag_ptr(this_arg);
59877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59879         this_arg_conv.is_owned = false;
59880         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
59881         int64_t ret_ref = 0;
59882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59884         return ret_ref;
59885 }
59886
59887 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
59888         LDKUnsignedInvoiceRequest this_arg_conv;
59889         this_arg_conv.inner = untag_ptr(this_arg);
59890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59892         this_arg_conv.is_owned = false;
59893         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
59894         int64_tArray ret_arr = NULL;
59895         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59896         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59897         for (size_t n = 0; n < ret_var.datalen; n++) {
59898                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59899                 int64_t ret_conv_13_ref = 0;
59900                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59901                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59902                 ret_arr_ptr[n] = ret_conv_13_ref;
59903         }
59904         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59905         FREE(ret_var.data);
59906         return ret_arr;
59907 }
59908
59909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59910         LDKUnsignedInvoiceRequest this_arg_conv;
59911         this_arg_conv.inner = untag_ptr(this_arg);
59912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59914         this_arg_conv.is_owned = false;
59915         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
59916         int64_t ret_ref = 0;
59917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59919         return ret_ref;
59920 }
59921
59922 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59923         LDKUnsignedInvoiceRequest this_arg_conv;
59924         this_arg_conv.inner = untag_ptr(this_arg);
59925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59927         this_arg_conv.is_owned = false;
59928         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59929         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
59930         return ret_arr;
59931 }
59932
59933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59934         LDKUnsignedInvoiceRequest this_arg_conv;
59935         this_arg_conv.inner = untag_ptr(this_arg);
59936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59938         this_arg_conv.is_owned = false;
59939         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
59940         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59941         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59942         return ret_arr;
59943 }
59944
59945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
59946         LDKUnsignedInvoiceRequest this_arg_conv;
59947         this_arg_conv.inner = untag_ptr(this_arg);
59948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59950         this_arg_conv.is_owned = false;
59951         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59952         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedInvoiceRequest_chain(&this_arg_conv).data);
59953         return ret_arr;
59954 }
59955
59956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
59957         LDKUnsignedInvoiceRequest this_arg_conv;
59958         this_arg_conv.inner = untag_ptr(this_arg);
59959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59961         this_arg_conv.is_owned = false;
59962         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59963         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
59964         int64_t ret_ref = tag_ptr(ret_copy, true);
59965         return ret_ref;
59966 }
59967
59968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59969         LDKUnsignedInvoiceRequest this_arg_conv;
59970         this_arg_conv.inner = untag_ptr(this_arg);
59971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59973         this_arg_conv.is_owned = false;
59974         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
59975         int64_t ret_ref = 0;
59976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59978         return ret_ref;
59979 }
59980
59981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59982         LDKUnsignedInvoiceRequest this_arg_conv;
59983         this_arg_conv.inner = untag_ptr(this_arg);
59984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59986         this_arg_conv.is_owned = false;
59987         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59988         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
59989         int64_t ret_ref = tag_ptr(ret_copy, true);
59990         return ret_ref;
59991 }
59992
59993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
59994         LDKUnsignedInvoiceRequest this_arg_conv;
59995         this_arg_conv.inner = untag_ptr(this_arg);
59996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59998         this_arg_conv.is_owned = false;
59999         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60000         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
60001         return ret_arr;
60002 }
60003
60004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60005         LDKUnsignedInvoiceRequest this_arg_conv;
60006         this_arg_conv.inner = untag_ptr(this_arg);
60007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60009         this_arg_conv.is_owned = false;
60010         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
60011         int64_t ret_ref = 0;
60012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60014         return ret_ref;
60015 }
60016
60017 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60018         LDKInvoiceRequest this_arg_conv;
60019         this_arg_conv.inner = untag_ptr(this_arg);
60020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60022         this_arg_conv.is_owned = false;
60023         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
60024         jobjectArray ret_arr = NULL;
60025         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60026         ;
60027         for (size_t i = 0; i < ret_var.datalen; i++) {
60028                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60029                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60030                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60031         }
60032         
60033         FREE(ret_var.data);
60034         return ret_arr;
60035 }
60036
60037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60038         LDKInvoiceRequest this_arg_conv;
60039         this_arg_conv.inner = untag_ptr(this_arg);
60040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60042         this_arg_conv.is_owned = false;
60043         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60044         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
60045         int64_t ret_ref = tag_ptr(ret_copy, true);
60046         return ret_ref;
60047 }
60048
60049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60050         LDKInvoiceRequest this_arg_conv;
60051         this_arg_conv.inner = untag_ptr(this_arg);
60052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60054         this_arg_conv.is_owned = false;
60055         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
60056         int64_t ret_ref = 0;
60057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60059         return ret_ref;
60060 }
60061
60062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60063         LDKInvoiceRequest this_arg_conv;
60064         this_arg_conv.inner = untag_ptr(this_arg);
60065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60067         this_arg_conv.is_owned = false;
60068         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
60069         int64_t ret_ref = 0;
60070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60072         return ret_ref;
60073 }
60074
60075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60076         LDKInvoiceRequest this_arg_conv;
60077         this_arg_conv.inner = untag_ptr(this_arg);
60078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60080         this_arg_conv.is_owned = false;
60081         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
60082         int64_t ret_ref = 0;
60083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60085         return ret_ref;
60086 }
60087
60088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60089         LDKInvoiceRequest this_arg_conv;
60090         this_arg_conv.inner = untag_ptr(this_arg);
60091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60093         this_arg_conv.is_owned = false;
60094         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60095         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
60096         int64_t ret_ref = tag_ptr(ret_copy, true);
60097         return ret_ref;
60098 }
60099
60100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60101         LDKInvoiceRequest this_arg_conv;
60102         this_arg_conv.inner = untag_ptr(this_arg);
60103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60105         this_arg_conv.is_owned = false;
60106         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
60107         int64_t ret_ref = 0;
60108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60110         return ret_ref;
60111 }
60112
60113 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60114         LDKInvoiceRequest this_arg_conv;
60115         this_arg_conv.inner = untag_ptr(this_arg);
60116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60118         this_arg_conv.is_owned = false;
60119         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
60120         int64_tArray ret_arr = NULL;
60121         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60122         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60123         for (size_t n = 0; n < ret_var.datalen; n++) {
60124                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60125                 int64_t ret_conv_13_ref = 0;
60126                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60127                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60128                 ret_arr_ptr[n] = ret_conv_13_ref;
60129         }
60130         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60131         FREE(ret_var.data);
60132         return ret_arr;
60133 }
60134
60135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60136         LDKInvoiceRequest this_arg_conv;
60137         this_arg_conv.inner = untag_ptr(this_arg);
60138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60140         this_arg_conv.is_owned = false;
60141         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
60142         int64_t ret_ref = 0;
60143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60145         return ret_ref;
60146 }
60147
60148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
60149         LDKInvoiceRequest this_arg_conv;
60150         this_arg_conv.inner = untag_ptr(this_arg);
60151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60153         this_arg_conv.is_owned = false;
60154         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60155         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
60156         return ret_arr;
60157 }
60158
60159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60160         LDKInvoiceRequest this_arg_conv;
60161         this_arg_conv.inner = untag_ptr(this_arg);
60162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60164         this_arg_conv.is_owned = false;
60165         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
60166         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60167         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60168         return ret_arr;
60169 }
60170
60171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60172         LDKInvoiceRequest this_arg_conv;
60173         this_arg_conv.inner = untag_ptr(this_arg);
60174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60176         this_arg_conv.is_owned = false;
60177         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60178         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
60179         return ret_arr;
60180 }
60181
60182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60183         LDKInvoiceRequest this_arg_conv;
60184         this_arg_conv.inner = untag_ptr(this_arg);
60185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60187         this_arg_conv.is_owned = false;
60188         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60189         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
60190         int64_t ret_ref = tag_ptr(ret_copy, true);
60191         return ret_ref;
60192 }
60193
60194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60195         LDKInvoiceRequest this_arg_conv;
60196         this_arg_conv.inner = untag_ptr(this_arg);
60197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60199         this_arg_conv.is_owned = false;
60200         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
60201         int64_t ret_ref = 0;
60202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60204         return ret_ref;
60205 }
60206
60207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60208         LDKInvoiceRequest this_arg_conv;
60209         this_arg_conv.inner = untag_ptr(this_arg);
60210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60212         this_arg_conv.is_owned = false;
60213         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60214         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
60215         int64_t ret_ref = tag_ptr(ret_copy, true);
60216         return ret_ref;
60217 }
60218
60219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60220         LDKInvoiceRequest this_arg_conv;
60221         this_arg_conv.inner = untag_ptr(this_arg);
60222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60224         this_arg_conv.is_owned = false;
60225         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60226         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
60227         return ret_arr;
60228 }
60229
60230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60231         LDKInvoiceRequest this_arg_conv;
60232         this_arg_conv.inner = untag_ptr(this_arg);
60233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60235         this_arg_conv.is_owned = false;
60236         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
60237         int64_t ret_ref = 0;
60238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60240         return ret_ref;
60241 }
60242
60243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
60244         LDKInvoiceRequest this_arg_conv;
60245         this_arg_conv.inner = untag_ptr(this_arg);
60246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60248         this_arg_conv.is_owned = false;
60249         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60250         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, InvoiceRequest_signature(&this_arg_conv).compact_form);
60251         return ret_arr;
60252 }
60253
60254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
60255         LDKInvoiceRequest this_arg_conv;
60256         this_arg_conv.inner = untag_ptr(this_arg);
60257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60259         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
60260         LDKExpandedKey key_conv;
60261         key_conv.inner = untag_ptr(key);
60262         key_conv.is_owned = ptr_is_owned(key);
60263         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
60264         key_conv.is_owned = false;
60265         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
60266         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
60267         return tag_ptr(ret_conv, true);
60268 }
60269
60270 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60271         LDKVerifiedInvoiceRequest this_arg_conv;
60272         this_arg_conv.inner = untag_ptr(this_arg);
60273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60275         this_arg_conv.is_owned = false;
60276         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
60277         jobjectArray ret_arr = NULL;
60278         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60279         ;
60280         for (size_t i = 0; i < ret_var.datalen; i++) {
60281                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60282                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60283                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60284         }
60285         
60286         FREE(ret_var.data);
60287         return ret_arr;
60288 }
60289
60290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60291         LDKVerifiedInvoiceRequest this_arg_conv;
60292         this_arg_conv.inner = untag_ptr(this_arg);
60293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60295         this_arg_conv.is_owned = false;
60296         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60297         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
60298         int64_t ret_ref = tag_ptr(ret_copy, true);
60299         return ret_ref;
60300 }
60301
60302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60303         LDKVerifiedInvoiceRequest this_arg_conv;
60304         this_arg_conv.inner = untag_ptr(this_arg);
60305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60307         this_arg_conv.is_owned = false;
60308         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
60309         int64_t ret_ref = 0;
60310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60312         return ret_ref;
60313 }
60314
60315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60316         LDKVerifiedInvoiceRequest this_arg_conv;
60317         this_arg_conv.inner = untag_ptr(this_arg);
60318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60320         this_arg_conv.is_owned = false;
60321         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
60322         int64_t ret_ref = 0;
60323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60325         return ret_ref;
60326 }
60327
60328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60329         LDKVerifiedInvoiceRequest this_arg_conv;
60330         this_arg_conv.inner = untag_ptr(this_arg);
60331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60333         this_arg_conv.is_owned = false;
60334         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
60335         int64_t ret_ref = 0;
60336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60338         return ret_ref;
60339 }
60340
60341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60342         LDKVerifiedInvoiceRequest this_arg_conv;
60343         this_arg_conv.inner = untag_ptr(this_arg);
60344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60346         this_arg_conv.is_owned = false;
60347         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60348         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
60349         int64_t ret_ref = tag_ptr(ret_copy, true);
60350         return ret_ref;
60351 }
60352
60353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60354         LDKVerifiedInvoiceRequest this_arg_conv;
60355         this_arg_conv.inner = untag_ptr(this_arg);
60356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60358         this_arg_conv.is_owned = false;
60359         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
60360         int64_t ret_ref = 0;
60361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60363         return ret_ref;
60364 }
60365
60366 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60367         LDKVerifiedInvoiceRequest this_arg_conv;
60368         this_arg_conv.inner = untag_ptr(this_arg);
60369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60371         this_arg_conv.is_owned = false;
60372         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
60373         int64_tArray ret_arr = NULL;
60374         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60375         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60376         for (size_t n = 0; n < ret_var.datalen; n++) {
60377                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60378                 int64_t ret_conv_13_ref = 0;
60379                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60380                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60381                 ret_arr_ptr[n] = ret_conv_13_ref;
60382         }
60383         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60384         FREE(ret_var.data);
60385         return ret_arr;
60386 }
60387
60388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60389         LDKVerifiedInvoiceRequest this_arg_conv;
60390         this_arg_conv.inner = untag_ptr(this_arg);
60391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60393         this_arg_conv.is_owned = false;
60394         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
60395         int64_t ret_ref = 0;
60396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60398         return ret_ref;
60399 }
60400
60401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
60402         LDKVerifiedInvoiceRequest this_arg_conv;
60403         this_arg_conv.inner = untag_ptr(this_arg);
60404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60406         this_arg_conv.is_owned = false;
60407         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60408         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
60409         return ret_arr;
60410 }
60411
60412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60413         LDKVerifiedInvoiceRequest this_arg_conv;
60414         this_arg_conv.inner = untag_ptr(this_arg);
60415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60417         this_arg_conv.is_owned = false;
60418         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
60419         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60420         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60421         return ret_arr;
60422 }
60423
60424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60425         LDKVerifiedInvoiceRequest this_arg_conv;
60426         this_arg_conv.inner = untag_ptr(this_arg);
60427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60429         this_arg_conv.is_owned = false;
60430         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60431         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, VerifiedInvoiceRequest_chain(&this_arg_conv).data);
60432         return ret_arr;
60433 }
60434
60435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60436         LDKVerifiedInvoiceRequest this_arg_conv;
60437         this_arg_conv.inner = untag_ptr(this_arg);
60438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60440         this_arg_conv.is_owned = false;
60441         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60442         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
60443         int64_t ret_ref = tag_ptr(ret_copy, true);
60444         return ret_ref;
60445 }
60446
60447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60448         LDKVerifiedInvoiceRequest this_arg_conv;
60449         this_arg_conv.inner = untag_ptr(this_arg);
60450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60452         this_arg_conv.is_owned = false;
60453         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
60454         int64_t ret_ref = 0;
60455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60457         return ret_ref;
60458 }
60459
60460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60461         LDKVerifiedInvoiceRequest this_arg_conv;
60462         this_arg_conv.inner = untag_ptr(this_arg);
60463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60465         this_arg_conv.is_owned = false;
60466         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60467         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
60468         int64_t ret_ref = tag_ptr(ret_copy, true);
60469         return ret_ref;
60470 }
60471
60472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60473         LDKVerifiedInvoiceRequest this_arg_conv;
60474         this_arg_conv.inner = untag_ptr(this_arg);
60475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60477         this_arg_conv.is_owned = false;
60478         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
60480         return ret_arr;
60481 }
60482
60483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60484         LDKVerifiedInvoiceRequest this_arg_conv;
60485         this_arg_conv.inner = untag_ptr(this_arg);
60486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60488         this_arg_conv.is_owned = false;
60489         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
60490         int64_t ret_ref = 0;
60491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60493         return ret_ref;
60494 }
60495
60496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
60497         LDKUnsignedInvoiceRequest obj_conv;
60498         obj_conv.inner = untag_ptr(obj);
60499         obj_conv.is_owned = ptr_is_owned(obj);
60500         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60501         obj_conv.is_owned = false;
60502         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
60503         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60504         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60505         CVec_u8Z_free(ret_var);
60506         return ret_arr;
60507 }
60508
60509 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
60510         LDKInvoiceRequest obj_conv;
60511         obj_conv.inner = untag_ptr(obj);
60512         obj_conv.is_owned = ptr_is_owned(obj);
60513         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60514         obj_conv.is_owned = false;
60515         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
60516         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60517         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60518         CVec_u8Z_free(ret_var);
60519         return ret_arr;
60520 }
60521
60522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TaggedHash_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60523         LDKTaggedHash this_obj_conv;
60524         this_obj_conv.inner = untag_ptr(this_obj);
60525         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60527         TaggedHash_free(this_obj_conv);
60528 }
60529
60530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60531         LDKBolt12ParseError this_obj_conv;
60532         this_obj_conv.inner = untag_ptr(this_obj);
60533         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60535         Bolt12ParseError_free(this_obj_conv);
60536 }
60537
60538 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
60539         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
60540         int64_t ret_ref = 0;
60541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60543         return ret_ref;
60544 }
60545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60546         LDKBolt12ParseError arg_conv;
60547         arg_conv.inner = untag_ptr(arg);
60548         arg_conv.is_owned = ptr_is_owned(arg);
60549         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60550         arg_conv.is_owned = false;
60551         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
60552         return ret_conv;
60553 }
60554
60555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60556         LDKBolt12ParseError orig_conv;
60557         orig_conv.inner = untag_ptr(orig);
60558         orig_conv.is_owned = ptr_is_owned(orig);
60559         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60560         orig_conv.is_owned = false;
60561         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
60562         int64_t ret_ref = 0;
60563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60565         return ret_ref;
60566 }
60567
60568 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60569         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
60570         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
60571         return ret_conv;
60572 }
60573
60574 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
60575         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
60576         return ret_conv;
60577 }
60578
60579 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
60580         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
60581         return ret_conv;
60582 }
60583
60584 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
60585         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
60586         return ret_conv;
60587 }
60588
60589 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
60590         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
60591         return ret_conv;
60592 }
60593
60594 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
60595         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
60596         return ret_conv;
60597 }
60598
60599 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
60600         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
60601         return ret_conv;
60602 }
60603
60604 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
60605         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
60606         return ret_conv;
60607 }
60608
60609 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
60610         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
60611         return ret_conv;
60612 }
60613
60614 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
60615         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
60616         return ret_conv;
60617 }
60618
60619 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
60620         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
60621         return ret_conv;
60622 }
60623
60624 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
60625         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
60626         return ret_conv;
60627 }
60628
60629 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
60630         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
60631         return ret_conv;
60632 }
60633
60634 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
60635         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
60636         return ret_conv;
60637 }
60638
60639 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
60640         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
60641         return ret_conv;
60642 }
60643
60644 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
60645         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
60646         return ret_conv;
60647 }
60648
60649 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
60650         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
60651         return ret_conv;
60652 }
60653
60654 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
60655         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
60656         return ret_conv;
60657 }
60658
60659 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
60660         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
60661         return ret_conv;
60662 }
60663
60664 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
60665         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
60666         return ret_conv;
60667 }
60668
60669 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
60670         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
60671         return ret_conv;
60672 }
60673
60674 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
60675         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
60676         return ret_conv;
60677 }
60678
60679 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
60680         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
60681         return ret_conv;
60682 }
60683
60684 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
60685         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
60686         return ret_conv;
60687 }
60688
60689 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
60690         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
60691         return ret_conv;
60692 }
60693
60694 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
60695         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
60696         return ret_conv;
60697 }
60698
60699 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
60700         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
60701         return ret_conv;
60702 }
60703
60704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60705         LDKRefund this_obj_conv;
60706         this_obj_conv.inner = untag_ptr(this_obj);
60707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60709         Refund_free(this_obj_conv);
60710 }
60711
60712 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
60713         LDKRefund ret_var = Refund_clone(arg);
60714         int64_t ret_ref = 0;
60715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60717         return ret_ref;
60718 }
60719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60720         LDKRefund arg_conv;
60721         arg_conv.inner = untag_ptr(arg);
60722         arg_conv.is_owned = ptr_is_owned(arg);
60723         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60724         arg_conv.is_owned = false;
60725         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
60726         return ret_conv;
60727 }
60728
60729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60730         LDKRefund orig_conv;
60731         orig_conv.inner = untag_ptr(orig);
60732         orig_conv.is_owned = ptr_is_owned(orig);
60733         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60734         orig_conv.is_owned = false;
60735         LDKRefund ret_var = Refund_clone(&orig_conv);
60736         int64_t ret_ref = 0;
60737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60739         return ret_ref;
60740 }
60741
60742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60743         LDKRefund this_arg_conv;
60744         this_arg_conv.inner = untag_ptr(this_arg);
60745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60747         this_arg_conv.is_owned = false;
60748         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
60749         int64_t ret_ref = 0;
60750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60752         return ret_ref;
60753 }
60754
60755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60756         LDKRefund this_arg_conv;
60757         this_arg_conv.inner = untag_ptr(this_arg);
60758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60760         this_arg_conv.is_owned = false;
60761         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60762         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
60763         int64_t ret_ref = tag_ptr(ret_copy, true);
60764         return ret_ref;
60765 }
60766
60767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
60768         LDKRefund this_arg_conv;
60769         this_arg_conv.inner = untag_ptr(this_arg);
60770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60772         this_arg_conv.is_owned = false;
60773         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
60774         return ret_conv;
60775 }
60776
60777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60778         LDKRefund this_arg_conv;
60779         this_arg_conv.inner = untag_ptr(this_arg);
60780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60782         this_arg_conv.is_owned = false;
60783         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
60784         int64_t ret_ref = 0;
60785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60787         return ret_ref;
60788 }
60789
60790 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60791         LDKRefund this_arg_conv;
60792         this_arg_conv.inner = untag_ptr(this_arg);
60793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60795         this_arg_conv.is_owned = false;
60796         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
60797         int64_tArray ret_arr = NULL;
60798         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60799         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60800         for (size_t n = 0; n < ret_var.datalen; n++) {
60801                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60802                 int64_t ret_conv_13_ref = 0;
60803                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60804                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60805                 ret_arr_ptr[n] = ret_conv_13_ref;
60806         }
60807         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60808         FREE(ret_var.data);
60809         return ret_arr;
60810 }
60811
60812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60813         LDKRefund this_arg_conv;
60814         this_arg_conv.inner = untag_ptr(this_arg);
60815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60817         this_arg_conv.is_owned = false;
60818         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
60819         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60820         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60821         return ret_arr;
60822 }
60823
60824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60825         LDKRefund this_arg_conv;
60826         this_arg_conv.inner = untag_ptr(this_arg);
60827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60829         this_arg_conv.is_owned = false;
60830         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60831         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
60832         return ret_arr;
60833 }
60834
60835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60836         LDKRefund this_arg_conv;
60837         this_arg_conv.inner = untag_ptr(this_arg);
60838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60840         this_arg_conv.is_owned = false;
60841         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
60842         return ret_conv;
60843 }
60844
60845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60846         LDKRefund this_arg_conv;
60847         this_arg_conv.inner = untag_ptr(this_arg);
60848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60850         this_arg_conv.is_owned = false;
60851         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
60852         int64_t ret_ref = 0;
60853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60855         return ret_ref;
60856 }
60857
60858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60859         LDKRefund this_arg_conv;
60860         this_arg_conv.inner = untag_ptr(this_arg);
60861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60863         this_arg_conv.is_owned = false;
60864         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60865         *ret_copy = Refund_quantity(&this_arg_conv);
60866         int64_t ret_ref = tag_ptr(ret_copy, true);
60867         return ret_ref;
60868 }
60869
60870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60871         LDKRefund this_arg_conv;
60872         this_arg_conv.inner = untag_ptr(this_arg);
60873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60875         this_arg_conv.is_owned = false;
60876         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60877         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
60878         return ret_arr;
60879 }
60880
60881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60882         LDKRefund this_arg_conv;
60883         this_arg_conv.inner = untag_ptr(this_arg);
60884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60886         this_arg_conv.is_owned = false;
60887         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
60888         int64_t ret_ref = 0;
60889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60891         return ret_ref;
60892 }
60893
60894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
60895         LDKRefund obj_conv;
60896         obj_conv.inner = untag_ptr(obj);
60897         obj_conv.is_owned = ptr_is_owned(obj);
60898         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60899         obj_conv.is_owned = false;
60900         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
60901         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60902         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60903         CVec_u8Z_free(ret_var);
60904         return ret_arr;
60905 }
60906
60907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
60908         LDKStr s_conv = java_to_owned_str(env, s);
60909         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
60910         *ret_conv = Refund_from_str(s_conv);
60911         return tag_ptr(ret_conv, true);
60912 }
60913
60914 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60915         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
60916         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
60917         return ret_conv;
60918 }
60919
60920 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
60921         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
60922         return ret_conv;
60923 }
60924
60925 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
60926         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
60927         return ret_conv;
60928 }
60929
60930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60931         if (!ptr_is_owned(this_ptr)) return;
60932         void* this_ptr_ptr = untag_ptr(this_ptr);
60933         CHECK_ACCESS(this_ptr_ptr);
60934         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
60935         FREE(untag_ptr(this_ptr));
60936         UtxoResult_free(this_ptr_conv);
60937 }
60938
60939 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
60940         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
60941         *ret_copy = UtxoResult_clone(arg);
60942         int64_t ret_ref = tag_ptr(ret_copy, true);
60943         return ret_ref;
60944 }
60945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60946         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
60947         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
60948         return ret_conv;
60949 }
60950
60951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60952         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
60953         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
60954         *ret_copy = UtxoResult_clone(orig_conv);
60955         int64_t ret_ref = tag_ptr(ret_copy, true);
60956         return ret_ref;
60957 }
60958
60959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
60960         void* a_ptr = untag_ptr(a);
60961         CHECK_ACCESS(a_ptr);
60962         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
60963         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
60964         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
60965         *ret_copy = UtxoResult_sync(a_conv);
60966         int64_t ret_ref = tag_ptr(ret_copy, true);
60967         return ret_ref;
60968 }
60969
60970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
60971         LDKUtxoFuture a_conv;
60972         a_conv.inner = untag_ptr(a);
60973         a_conv.is_owned = ptr_is_owned(a);
60974         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60975         a_conv = UtxoFuture_clone(&a_conv);
60976         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
60977         *ret_copy = UtxoResult_async(a_conv);
60978         int64_t ret_ref = tag_ptr(ret_copy, true);
60979         return ret_ref;
60980 }
60981
60982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60983         if (!ptr_is_owned(this_ptr)) return;
60984         void* this_ptr_ptr = untag_ptr(this_ptr);
60985         CHECK_ACCESS(this_ptr_ptr);
60986         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
60987         FREE(untag_ptr(this_ptr));
60988         UtxoLookup_free(this_ptr_conv);
60989 }
60990
60991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60992         LDKUtxoFuture this_obj_conv;
60993         this_obj_conv.inner = untag_ptr(this_obj);
60994         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60996         UtxoFuture_free(this_obj_conv);
60997 }
60998
60999 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
61000         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
61001         int64_t ret_ref = 0;
61002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61004         return ret_ref;
61005 }
61006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61007         LDKUtxoFuture arg_conv;
61008         arg_conv.inner = untag_ptr(arg);
61009         arg_conv.is_owned = ptr_is_owned(arg);
61010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61011         arg_conv.is_owned = false;
61012         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
61013         return ret_conv;
61014 }
61015
61016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61017         LDKUtxoFuture orig_conv;
61018         orig_conv.inner = untag_ptr(orig);
61019         orig_conv.is_owned = ptr_is_owned(orig);
61020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61021         orig_conv.is_owned = false;
61022         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
61023         int64_t ret_ref = 0;
61024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61026         return ret_ref;
61027 }
61028
61029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
61030         LDKUtxoFuture ret_var = UtxoFuture_new();
61031         int64_t ret_ref = 0;
61032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61034         return ret_ref;
61035 }
61036
61037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve_1without_1forwarding(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t result) {
61038         LDKUtxoFuture this_arg_conv;
61039         this_arg_conv.inner = untag_ptr(this_arg);
61040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61042         this_arg_conv.is_owned = false;
61043         LDKNetworkGraph graph_conv;
61044         graph_conv.inner = untag_ptr(graph);
61045         graph_conv.is_owned = ptr_is_owned(graph);
61046         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61047         graph_conv.is_owned = false;
61048         void* result_ptr = untag_ptr(result);
61049         CHECK_ACCESS(result_ptr);
61050         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61051         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
61052 }
61053
61054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t gossip, int64_t result) {
61055         LDKUtxoFuture this_arg_conv;
61056         this_arg_conv.inner = untag_ptr(this_arg);
61057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61059         this_arg_conv.is_owned = false;
61060         LDKNetworkGraph graph_conv;
61061         graph_conv.inner = untag_ptr(graph);
61062         graph_conv.is_owned = ptr_is_owned(graph);
61063         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61064         graph_conv.is_owned = false;
61065         LDKP2PGossipSync gossip_conv;
61066         gossip_conv.inner = untag_ptr(gossip);
61067         gossip_conv.is_owned = ptr_is_owned(gossip);
61068         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
61069         gossip_conv.is_owned = false;
61070         void* result_ptr = untag_ptr(result);
61071         CHECK_ACCESS(result_ptr);
61072         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61073         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
61074 }
61075
61076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61077         LDKNodeId this_obj_conv;
61078         this_obj_conv.inner = untag_ptr(this_obj);
61079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61081         NodeId_free(this_obj_conv);
61082 }
61083
61084 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
61085         LDKNodeId ret_var = NodeId_clone(arg);
61086         int64_t ret_ref = 0;
61087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61089         return ret_ref;
61090 }
61091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61092         LDKNodeId arg_conv;
61093         arg_conv.inner = untag_ptr(arg);
61094         arg_conv.is_owned = ptr_is_owned(arg);
61095         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61096         arg_conv.is_owned = false;
61097         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
61098         return ret_conv;
61099 }
61100
61101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61102         LDKNodeId orig_conv;
61103         orig_conv.inner = untag_ptr(orig);
61104         orig_conv.is_owned = ptr_is_owned(orig);
61105         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61106         orig_conv.is_owned = false;
61107         LDKNodeId ret_var = NodeId_clone(&orig_conv);
61108         int64_t ret_ref = 0;
61109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61111         return ret_ref;
61112 }
61113
61114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
61115         LDKPublicKey pubkey_ref;
61116         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
61117         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
61118         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
61119         int64_t ret_ref = 0;
61120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61122         return ret_ref;
61123 }
61124
61125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
61126         LDKNodeId this_arg_conv;
61127         this_arg_conv.inner = untag_ptr(this_arg);
61128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61130         this_arg_conv.is_owned = false;
61131         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
61132         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61133         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61134         return ret_arr;
61135 }
61136
61137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
61138         LDKNodeId this_arg_conv;
61139         this_arg_conv.inner = untag_ptr(this_arg);
61140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61142         this_arg_conv.is_owned = false;
61143         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
61144         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
61145         return tag_ptr(ret_conv, true);
61146 }
61147
61148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
61149         LDKNodeId o_conv;
61150         o_conv.inner = untag_ptr(o);
61151         o_conv.is_owned = ptr_is_owned(o);
61152         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61153         o_conv.is_owned = false;
61154         int64_t ret_conv = NodeId_hash(&o_conv);
61155         return ret_conv;
61156 }
61157
61158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
61159         LDKNodeId obj_conv;
61160         obj_conv.inner = untag_ptr(obj);
61161         obj_conv.is_owned = ptr_is_owned(obj);
61162         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61163         obj_conv.is_owned = false;
61164         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
61165         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61166         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61167         CVec_u8Z_free(ret_var);
61168         return ret_arr;
61169 }
61170
61171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61172         LDKu8slice ser_ref;
61173         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61174         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61175         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
61176         *ret_conv = NodeId_read(ser_ref);
61177         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61178         return tag_ptr(ret_conv, true);
61179 }
61180
61181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61182         LDKNetworkGraph this_obj_conv;
61183         this_obj_conv.inner = untag_ptr(this_obj);
61184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61186         NetworkGraph_free(this_obj_conv);
61187 }
61188
61189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61190         LDKReadOnlyNetworkGraph this_obj_conv;
61191         this_obj_conv.inner = untag_ptr(this_obj);
61192         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61194         ReadOnlyNetworkGraph_free(this_obj_conv);
61195 }
61196
61197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61198         if (!ptr_is_owned(this_ptr)) return;
61199         void* this_ptr_ptr = untag_ptr(this_ptr);
61200         CHECK_ACCESS(this_ptr_ptr);
61201         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
61202         FREE(untag_ptr(this_ptr));
61203         NetworkUpdate_free(this_ptr_conv);
61204 }
61205
61206 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
61207         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61208         *ret_copy = NetworkUpdate_clone(arg);
61209         int64_t ret_ref = tag_ptr(ret_copy, true);
61210         return ret_ref;
61211 }
61212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61213         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
61214         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
61215         return ret_conv;
61216 }
61217
61218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61219         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
61220         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61221         *ret_copy = NetworkUpdate_clone(orig_conv);
61222         int64_t ret_ref = tag_ptr(ret_copy, true);
61223         return ret_ref;
61224 }
61225
61226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
61227         LDKChannelUpdate msg_conv;
61228         msg_conv.inner = untag_ptr(msg);
61229         msg_conv.is_owned = ptr_is_owned(msg);
61230         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61231         msg_conv = ChannelUpdate_clone(&msg_conv);
61232         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61233         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
61234         int64_t ret_ref = tag_ptr(ret_copy, true);
61235         return ret_ref;
61236 }
61237
61238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
61239         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61240         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
61241         int64_t ret_ref = tag_ptr(ret_copy, true);
61242         return ret_ref;
61243 }
61244
61245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
61246         LDKPublicKey node_id_ref;
61247         CHECK((*env)->GetArrayLength(env, node_id) == 33);
61248         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
61249         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61250         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
61251         int64_t ret_ref = tag_ptr(ret_copy, true);
61252         return ret_ref;
61253 }
61254
61255 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61256         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
61257         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
61258         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
61259         return ret_conv;
61260 }
61261
61262 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
61263         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
61264         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
61265         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61266         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61267         CVec_u8Z_free(ret_var);
61268         return ret_arr;
61269 }
61270
61271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61272         LDKu8slice ser_ref;
61273         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61274         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61275         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
61276         *ret_conv = NetworkUpdate_read(ser_ref);
61277         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61278         return tag_ptr(ret_conv, true);
61279 }
61280
61281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61282         LDKP2PGossipSync this_obj_conv;
61283         this_obj_conv.inner = untag_ptr(this_obj);
61284         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61286         P2PGossipSync_free(this_obj_conv);
61287 }
61288
61289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t utxo_lookup, int64_t logger) {
61290         LDKNetworkGraph network_graph_conv;
61291         network_graph_conv.inner = untag_ptr(network_graph);
61292         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61293         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61294         network_graph_conv.is_owned = false;
61295         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61296         CHECK_ACCESS(utxo_lookup_ptr);
61297         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61298         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61299         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61300                 // Manually implement clone for Java trait instances
61301                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61302                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61303                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61304                 }
61305         }
61306         void* logger_ptr = untag_ptr(logger);
61307         CHECK_ACCESS(logger_ptr);
61308         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61309         if (logger_conv.free == LDKLogger_JCalls_free) {
61310                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61311                 LDKLogger_JCalls_cloned(&logger_conv);
61312         }
61313         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
61314         int64_t ret_ref = 0;
61315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61317         return ret_ref;
61318 }
61319
61320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
61321         LDKP2PGossipSync this_arg_conv;
61322         this_arg_conv.inner = untag_ptr(this_arg);
61323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61325         this_arg_conv.is_owned = false;
61326         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61327         CHECK_ACCESS(utxo_lookup_ptr);
61328         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61329         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61330         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61331                 // Manually implement clone for Java trait instances
61332                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61333                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61334                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61335                 }
61336         }
61337         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
61338 }
61339
61340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
61341         LDKNetworkGraph this_arg_conv;
61342         this_arg_conv.inner = untag_ptr(this_arg);
61343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61345         this_arg_conv.is_owned = false;
61346         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
61347         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
61348 }
61349
61350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1genesis_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
61351         LDKNetworkGraph this_arg_conv;
61352         this_arg_conv.inner = untag_ptr(this_arg);
61353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61355         this_arg_conv.is_owned = false;
61356         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
61357         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_genesis_hash(&this_arg_conv).data);
61358         return ret_arr;
61359 }
61360
61361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
61362         LDKNodeAnnouncement msg_conv;
61363         msg_conv.inner = untag_ptr(msg);
61364         msg_conv.is_owned = ptr_is_owned(msg);
61365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61366         msg_conv.is_owned = false;
61367         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
61368         *ret_conv = verify_node_announcement(&msg_conv);
61369         return tag_ptr(ret_conv, true);
61370 }
61371
61372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
61373         LDKChannelAnnouncement msg_conv;
61374         msg_conv.inner = untag_ptr(msg);
61375         msg_conv.is_owned = ptr_is_owned(msg);
61376         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61377         msg_conv.is_owned = false;
61378         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
61379         *ret_conv = verify_channel_announcement(&msg_conv);
61380         return tag_ptr(ret_conv, true);
61381 }
61382
61383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61384         LDKP2PGossipSync this_arg_conv;
61385         this_arg_conv.inner = untag_ptr(this_arg);
61386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61388         this_arg_conv.is_owned = false;
61389         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
61390         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
61391         return tag_ptr(ret_ret, true);
61392 }
61393
61394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
61395         LDKP2PGossipSync this_arg_conv;
61396         this_arg_conv.inner = untag_ptr(this_arg);
61397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61399         this_arg_conv.is_owned = false;
61400         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
61401         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
61402         return tag_ptr(ret_ret, true);
61403 }
61404
61405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61406         LDKChannelUpdateInfo this_obj_conv;
61407         this_obj_conv.inner = untag_ptr(this_obj);
61408         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61410         ChannelUpdateInfo_free(this_obj_conv);
61411 }
61412
61413 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
61414         LDKChannelUpdateInfo this_ptr_conv;
61415         this_ptr_conv.inner = untag_ptr(this_ptr);
61416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61418         this_ptr_conv.is_owned = false;
61419         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
61420         return ret_conv;
61421 }
61422
61423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
61424         LDKChannelUpdateInfo this_ptr_conv;
61425         this_ptr_conv.inner = untag_ptr(this_ptr);
61426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61428         this_ptr_conv.is_owned = false;
61429         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
61430 }
61431
61432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
61433         LDKChannelUpdateInfo this_ptr_conv;
61434         this_ptr_conv.inner = untag_ptr(this_ptr);
61435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61437         this_ptr_conv.is_owned = false;
61438         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
61439         return ret_conv;
61440 }
61441
61442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
61443         LDKChannelUpdateInfo this_ptr_conv;
61444         this_ptr_conv.inner = untag_ptr(this_ptr);
61445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61447         this_ptr_conv.is_owned = false;
61448         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
61449 }
61450
61451 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
61452         LDKChannelUpdateInfo this_ptr_conv;
61453         this_ptr_conv.inner = untag_ptr(this_ptr);
61454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61456         this_ptr_conv.is_owned = false;
61457         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
61458         return ret_conv;
61459 }
61460
61461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
61462         LDKChannelUpdateInfo this_ptr_conv;
61463         this_ptr_conv.inner = untag_ptr(this_ptr);
61464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61466         this_ptr_conv.is_owned = false;
61467         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
61468 }
61469
61470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61471         LDKChannelUpdateInfo this_ptr_conv;
61472         this_ptr_conv.inner = untag_ptr(this_ptr);
61473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61475         this_ptr_conv.is_owned = false;
61476         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
61477         return ret_conv;
61478 }
61479
61480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61481         LDKChannelUpdateInfo this_ptr_conv;
61482         this_ptr_conv.inner = untag_ptr(this_ptr);
61483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61485         this_ptr_conv.is_owned = false;
61486         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
61487 }
61488
61489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61490         LDKChannelUpdateInfo this_ptr_conv;
61491         this_ptr_conv.inner = untag_ptr(this_ptr);
61492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61494         this_ptr_conv.is_owned = false;
61495         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
61496         return ret_conv;
61497 }
61498
61499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61500         LDKChannelUpdateInfo this_ptr_conv;
61501         this_ptr_conv.inner = untag_ptr(this_ptr);
61502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61504         this_ptr_conv.is_owned = false;
61505         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
61506 }
61507
61508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
61509         LDKChannelUpdateInfo this_ptr_conv;
61510         this_ptr_conv.inner = untag_ptr(this_ptr);
61511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61513         this_ptr_conv.is_owned = false;
61514         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
61515         int64_t ret_ref = 0;
61516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61518         return ret_ref;
61519 }
61520
61521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61522         LDKChannelUpdateInfo this_ptr_conv;
61523         this_ptr_conv.inner = untag_ptr(this_ptr);
61524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61526         this_ptr_conv.is_owned = false;
61527         LDKRoutingFees val_conv;
61528         val_conv.inner = untag_ptr(val);
61529         val_conv.is_owned = ptr_is_owned(val);
61530         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61531         val_conv = RoutingFees_clone(&val_conv);
61532         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
61533 }
61534
61535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
61536         LDKChannelUpdateInfo this_ptr_conv;
61537         this_ptr_conv.inner = untag_ptr(this_ptr);
61538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61540         this_ptr_conv.is_owned = false;
61541         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
61542         int64_t ret_ref = 0;
61543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61545         return ret_ref;
61546 }
61547
61548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61549         LDKChannelUpdateInfo this_ptr_conv;
61550         this_ptr_conv.inner = untag_ptr(this_ptr);
61551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61553         this_ptr_conv.is_owned = false;
61554         LDKChannelUpdate val_conv;
61555         val_conv.inner = untag_ptr(val);
61556         val_conv.is_owned = ptr_is_owned(val);
61557         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61558         val_conv = ChannelUpdate_clone(&val_conv);
61559         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
61560 }
61561
61562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
61563         LDKRoutingFees fees_arg_conv;
61564         fees_arg_conv.inner = untag_ptr(fees_arg);
61565         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
61566         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
61567         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
61568         LDKChannelUpdate last_update_message_arg_conv;
61569         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
61570         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
61571         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
61572         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
61573         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg_conv, last_update_message_arg_conv);
61574         int64_t ret_ref = 0;
61575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61577         return ret_ref;
61578 }
61579
61580 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
61581         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
61582         int64_t ret_ref = 0;
61583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61585         return ret_ref;
61586 }
61587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61588         LDKChannelUpdateInfo arg_conv;
61589         arg_conv.inner = untag_ptr(arg);
61590         arg_conv.is_owned = ptr_is_owned(arg);
61591         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61592         arg_conv.is_owned = false;
61593         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
61594         return ret_conv;
61595 }
61596
61597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61598         LDKChannelUpdateInfo orig_conv;
61599         orig_conv.inner = untag_ptr(orig);
61600         orig_conv.is_owned = ptr_is_owned(orig);
61601         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61602         orig_conv.is_owned = false;
61603         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
61604         int64_t ret_ref = 0;
61605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61607         return ret_ref;
61608 }
61609
61610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61611         LDKChannelUpdateInfo a_conv;
61612         a_conv.inner = untag_ptr(a);
61613         a_conv.is_owned = ptr_is_owned(a);
61614         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61615         a_conv.is_owned = false;
61616         LDKChannelUpdateInfo b_conv;
61617         b_conv.inner = untag_ptr(b);
61618         b_conv.is_owned = ptr_is_owned(b);
61619         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61620         b_conv.is_owned = false;
61621         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
61622         return ret_conv;
61623 }
61624
61625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
61626         LDKChannelUpdateInfo obj_conv;
61627         obj_conv.inner = untag_ptr(obj);
61628         obj_conv.is_owned = ptr_is_owned(obj);
61629         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61630         obj_conv.is_owned = false;
61631         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
61632         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61633         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61634         CVec_u8Z_free(ret_var);
61635         return ret_arr;
61636 }
61637
61638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61639         LDKu8slice ser_ref;
61640         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61641         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61642         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
61643         *ret_conv = ChannelUpdateInfo_read(ser_ref);
61644         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61645         return tag_ptr(ret_conv, true);
61646 }
61647
61648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61649         LDKChannelInfo this_obj_conv;
61650         this_obj_conv.inner = untag_ptr(this_obj);
61651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61653         ChannelInfo_free(this_obj_conv);
61654 }
61655
61656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
61657         LDKChannelInfo this_ptr_conv;
61658         this_ptr_conv.inner = untag_ptr(this_ptr);
61659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61661         this_ptr_conv.is_owned = false;
61662         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
61663         int64_t ret_ref = 0;
61664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61666         return ret_ref;
61667 }
61668
61669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61670         LDKChannelInfo this_ptr_conv;
61671         this_ptr_conv.inner = untag_ptr(this_ptr);
61672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61674         this_ptr_conv.is_owned = false;
61675         LDKChannelFeatures val_conv;
61676         val_conv.inner = untag_ptr(val);
61677         val_conv.is_owned = ptr_is_owned(val);
61678         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61679         val_conv = ChannelFeatures_clone(&val_conv);
61680         ChannelInfo_set_features(&this_ptr_conv, val_conv);
61681 }
61682
61683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
61684         LDKChannelInfo this_ptr_conv;
61685         this_ptr_conv.inner = untag_ptr(this_ptr);
61686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61688         this_ptr_conv.is_owned = false;
61689         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
61690         int64_t ret_ref = 0;
61691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61693         return ret_ref;
61694 }
61695
61696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61697         LDKChannelInfo this_ptr_conv;
61698         this_ptr_conv.inner = untag_ptr(this_ptr);
61699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61701         this_ptr_conv.is_owned = false;
61702         LDKNodeId val_conv;
61703         val_conv.inner = untag_ptr(val);
61704         val_conv.is_owned = ptr_is_owned(val);
61705         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61706         val_conv = NodeId_clone(&val_conv);
61707         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
61708 }
61709
61710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
61711         LDKChannelInfo this_ptr_conv;
61712         this_ptr_conv.inner = untag_ptr(this_ptr);
61713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61715         this_ptr_conv.is_owned = false;
61716         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
61717         int64_t ret_ref = 0;
61718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61720         return ret_ref;
61721 }
61722
61723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61724         LDKChannelInfo this_ptr_conv;
61725         this_ptr_conv.inner = untag_ptr(this_ptr);
61726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61728         this_ptr_conv.is_owned = false;
61729         LDKChannelUpdateInfo val_conv;
61730         val_conv.inner = untag_ptr(val);
61731         val_conv.is_owned = ptr_is_owned(val);
61732         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61733         val_conv = ChannelUpdateInfo_clone(&val_conv);
61734         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
61735 }
61736
61737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
61738         LDKChannelInfo this_ptr_conv;
61739         this_ptr_conv.inner = untag_ptr(this_ptr);
61740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61742         this_ptr_conv.is_owned = false;
61743         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
61744         int64_t ret_ref = 0;
61745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61747         return ret_ref;
61748 }
61749
61750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61751         LDKChannelInfo this_ptr_conv;
61752         this_ptr_conv.inner = untag_ptr(this_ptr);
61753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61755         this_ptr_conv.is_owned = false;
61756         LDKNodeId val_conv;
61757         val_conv.inner = untag_ptr(val);
61758         val_conv.is_owned = ptr_is_owned(val);
61759         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61760         val_conv = NodeId_clone(&val_conv);
61761         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
61762 }
61763
61764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
61765         LDKChannelInfo this_ptr_conv;
61766         this_ptr_conv.inner = untag_ptr(this_ptr);
61767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61769         this_ptr_conv.is_owned = false;
61770         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
61771         int64_t ret_ref = 0;
61772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61774         return ret_ref;
61775 }
61776
61777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61778         LDKChannelInfo this_ptr_conv;
61779         this_ptr_conv.inner = untag_ptr(this_ptr);
61780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61782         this_ptr_conv.is_owned = false;
61783         LDKChannelUpdateInfo val_conv;
61784         val_conv.inner = untag_ptr(val);
61785         val_conv.is_owned = ptr_is_owned(val);
61786         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61787         val_conv = ChannelUpdateInfo_clone(&val_conv);
61788         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
61789 }
61790
61791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
61792         LDKChannelInfo this_ptr_conv;
61793         this_ptr_conv.inner = untag_ptr(this_ptr);
61794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61796         this_ptr_conv.is_owned = false;
61797         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61798         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
61799         int64_t ret_ref = tag_ptr(ret_copy, true);
61800         return ret_ref;
61801 }
61802
61803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61804         LDKChannelInfo this_ptr_conv;
61805         this_ptr_conv.inner = untag_ptr(this_ptr);
61806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61808         this_ptr_conv.is_owned = false;
61809         void* val_ptr = untag_ptr(val);
61810         CHECK_ACCESS(val_ptr);
61811         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
61812         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
61813         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
61814 }
61815
61816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
61817         LDKChannelInfo this_ptr_conv;
61818         this_ptr_conv.inner = untag_ptr(this_ptr);
61819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61821         this_ptr_conv.is_owned = false;
61822         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
61823         int64_t ret_ref = 0;
61824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61826         return ret_ref;
61827 }
61828
61829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61830         LDKChannelInfo this_ptr_conv;
61831         this_ptr_conv.inner = untag_ptr(this_ptr);
61832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61834         this_ptr_conv.is_owned = false;
61835         LDKChannelAnnouncement val_conv;
61836         val_conv.inner = untag_ptr(val);
61837         val_conv.is_owned = ptr_is_owned(val);
61838         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61839         val_conv = ChannelAnnouncement_clone(&val_conv);
61840         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
61841 }
61842
61843 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
61844         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
61845         int64_t ret_ref = 0;
61846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61848         return ret_ref;
61849 }
61850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61851         LDKChannelInfo arg_conv;
61852         arg_conv.inner = untag_ptr(arg);
61853         arg_conv.is_owned = ptr_is_owned(arg);
61854         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61855         arg_conv.is_owned = false;
61856         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
61857         return ret_conv;
61858 }
61859
61860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61861         LDKChannelInfo orig_conv;
61862         orig_conv.inner = untag_ptr(orig);
61863         orig_conv.is_owned = ptr_is_owned(orig);
61864         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61865         orig_conv.is_owned = false;
61866         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
61867         int64_t ret_ref = 0;
61868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61870         return ret_ref;
61871 }
61872
61873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61874         LDKChannelInfo a_conv;
61875         a_conv.inner = untag_ptr(a);
61876         a_conv.is_owned = ptr_is_owned(a);
61877         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61878         a_conv.is_owned = false;
61879         LDKChannelInfo b_conv;
61880         b_conv.inner = untag_ptr(b);
61881         b_conv.is_owned = ptr_is_owned(b);
61882         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61883         b_conv.is_owned = false;
61884         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
61885         return ret_conv;
61886 }
61887
61888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1directional_1info(JNIEnv *env, jclass clz, int64_t this_arg, int8_t channel_flags) {
61889         LDKChannelInfo this_arg_conv;
61890         this_arg_conv.inner = untag_ptr(this_arg);
61891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61893         this_arg_conv.is_owned = false;
61894         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
61895         int64_t ret_ref = 0;
61896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61898         return ret_ref;
61899 }
61900
61901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
61902         LDKChannelInfo obj_conv;
61903         obj_conv.inner = untag_ptr(obj);
61904         obj_conv.is_owned = ptr_is_owned(obj);
61905         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61906         obj_conv.is_owned = false;
61907         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
61908         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61909         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61910         CVec_u8Z_free(ret_var);
61911         return ret_arr;
61912 }
61913
61914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61915         LDKu8slice ser_ref;
61916         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61917         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61918         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
61919         *ret_conv = ChannelInfo_read(ser_ref);
61920         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61921         return tag_ptr(ret_conv, true);
61922 }
61923
61924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61925         LDKDirectedChannelInfo this_obj_conv;
61926         this_obj_conv.inner = untag_ptr(this_obj);
61927         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61929         DirectedChannelInfo_free(this_obj_conv);
61930 }
61931
61932 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
61933         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
61934         int64_t ret_ref = 0;
61935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61937         return ret_ref;
61938 }
61939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61940         LDKDirectedChannelInfo arg_conv;
61941         arg_conv.inner = untag_ptr(arg);
61942         arg_conv.is_owned = ptr_is_owned(arg);
61943         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61944         arg_conv.is_owned = false;
61945         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
61946         return ret_conv;
61947 }
61948
61949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61950         LDKDirectedChannelInfo orig_conv;
61951         orig_conv.inner = untag_ptr(orig);
61952         orig_conv.is_owned = ptr_is_owned(orig);
61953         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61954         orig_conv.is_owned = false;
61955         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
61956         int64_t ret_ref = 0;
61957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61959         return ret_ref;
61960 }
61961
61962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
61963         LDKDirectedChannelInfo this_arg_conv;
61964         this_arg_conv.inner = untag_ptr(this_arg);
61965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61967         this_arg_conv.is_owned = false;
61968         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
61969         int64_t ret_ref = 0;
61970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61972         return ret_ref;
61973 }
61974
61975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
61976         LDKDirectedChannelInfo this_arg_conv;
61977         this_arg_conv.inner = untag_ptr(this_arg);
61978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61980         this_arg_conv.is_owned = false;
61981         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
61982         return ret_conv;
61983 }
61984
61985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
61986         LDKDirectedChannelInfo this_arg_conv;
61987         this_arg_conv.inner = untag_ptr(this_arg);
61988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61990         this_arg_conv.is_owned = false;
61991         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
61992         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
61993         int64_t ret_ref = tag_ptr(ret_copy, true);
61994         return ret_ref;
61995 }
61996
61997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61998         if (!ptr_is_owned(this_ptr)) return;
61999         void* this_ptr_ptr = untag_ptr(this_ptr);
62000         CHECK_ACCESS(this_ptr_ptr);
62001         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
62002         FREE(untag_ptr(this_ptr));
62003         EffectiveCapacity_free(this_ptr_conv);
62004 }
62005
62006 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
62007         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62008         *ret_copy = EffectiveCapacity_clone(arg);
62009         int64_t ret_ref = tag_ptr(ret_copy, true);
62010         return ret_ref;
62011 }
62012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62013         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
62014         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
62015         return ret_conv;
62016 }
62017
62018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62019         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
62020         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62021         *ret_copy = EffectiveCapacity_clone(orig_conv);
62022         int64_t ret_ref = tag_ptr(ret_copy, true);
62023         return ret_ref;
62024 }
62025
62026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
62027         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62028         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
62029         int64_t ret_ref = tag_ptr(ret_copy, true);
62030         return ret_ref;
62031 }
62032
62033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
62034         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62035         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
62036         int64_t ret_ref = tag_ptr(ret_copy, true);
62037         return ret_ref;
62038 }
62039
62040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
62041         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62042         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
62043         int64_t ret_ref = tag_ptr(ret_copy, true);
62044         return ret_ref;
62045 }
62046
62047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
62048         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62049         *ret_copy = EffectiveCapacity_infinite();
62050         int64_t ret_ref = tag_ptr(ret_copy, true);
62051         return ret_ref;
62052 }
62053
62054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
62055         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62056         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
62057         int64_t ret_ref = tag_ptr(ret_copy, true);
62058         return ret_ref;
62059 }
62060
62061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
62062         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62063         *ret_copy = EffectiveCapacity_unknown();
62064         int64_t ret_ref = tag_ptr(ret_copy, true);
62065         return ret_ref;
62066 }
62067
62068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
62069         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
62070         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
62071         return ret_conv;
62072 }
62073
62074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62075         LDKRoutingFees this_obj_conv;
62076         this_obj_conv.inner = untag_ptr(this_obj);
62077         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62079         RoutingFees_free(this_obj_conv);
62080 }
62081
62082 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
62083         LDKRoutingFees this_ptr_conv;
62084         this_ptr_conv.inner = untag_ptr(this_ptr);
62085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62087         this_ptr_conv.is_owned = false;
62088         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
62089         return ret_conv;
62090 }
62091
62092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62093         LDKRoutingFees this_ptr_conv;
62094         this_ptr_conv.inner = untag_ptr(this_ptr);
62095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62097         this_ptr_conv.is_owned = false;
62098         RoutingFees_set_base_msat(&this_ptr_conv, val);
62099 }
62100
62101 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
62102         LDKRoutingFees this_ptr_conv;
62103         this_ptr_conv.inner = untag_ptr(this_ptr);
62104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62106         this_ptr_conv.is_owned = false;
62107         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
62108         return ret_conv;
62109 }
62110
62111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62112         LDKRoutingFees this_ptr_conv;
62113         this_ptr_conv.inner = untag_ptr(this_ptr);
62114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62116         this_ptr_conv.is_owned = false;
62117         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
62118 }
62119
62120 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) {
62121         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
62122         int64_t ret_ref = 0;
62123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62125         return ret_ref;
62126 }
62127
62128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62129         LDKRoutingFees a_conv;
62130         a_conv.inner = untag_ptr(a);
62131         a_conv.is_owned = ptr_is_owned(a);
62132         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62133         a_conv.is_owned = false;
62134         LDKRoutingFees b_conv;
62135         b_conv.inner = untag_ptr(b);
62136         b_conv.is_owned = ptr_is_owned(b);
62137         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62138         b_conv.is_owned = false;
62139         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
62140         return ret_conv;
62141 }
62142
62143 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
62144         LDKRoutingFees ret_var = RoutingFees_clone(arg);
62145         int64_t ret_ref = 0;
62146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62148         return ret_ref;
62149 }
62150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62151         LDKRoutingFees arg_conv;
62152         arg_conv.inner = untag_ptr(arg);
62153         arg_conv.is_owned = ptr_is_owned(arg);
62154         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62155         arg_conv.is_owned = false;
62156         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
62157         return ret_conv;
62158 }
62159
62160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62161         LDKRoutingFees orig_conv;
62162         orig_conv.inner = untag_ptr(orig);
62163         orig_conv.is_owned = ptr_is_owned(orig);
62164         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62165         orig_conv.is_owned = false;
62166         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
62167         int64_t ret_ref = 0;
62168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62170         return ret_ref;
62171 }
62172
62173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
62174         LDKRoutingFees o_conv;
62175         o_conv.inner = untag_ptr(o);
62176         o_conv.is_owned = ptr_is_owned(o);
62177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62178         o_conv.is_owned = false;
62179         int64_t ret_conv = RoutingFees_hash(&o_conv);
62180         return ret_conv;
62181 }
62182
62183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
62184         LDKRoutingFees obj_conv;
62185         obj_conv.inner = untag_ptr(obj);
62186         obj_conv.is_owned = ptr_is_owned(obj);
62187         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62188         obj_conv.is_owned = false;
62189         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
62190         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62191         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62192         CVec_u8Z_free(ret_var);
62193         return ret_arr;
62194 }
62195
62196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62197         LDKu8slice ser_ref;
62198         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62199         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62200         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
62201         *ret_conv = RoutingFees_read(ser_ref);
62202         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62203         return tag_ptr(ret_conv, true);
62204 }
62205
62206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62207         LDKNodeAnnouncementInfo this_obj_conv;
62208         this_obj_conv.inner = untag_ptr(this_obj);
62209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62211         NodeAnnouncementInfo_free(this_obj_conv);
62212 }
62213
62214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
62215         LDKNodeAnnouncementInfo this_ptr_conv;
62216         this_ptr_conv.inner = untag_ptr(this_ptr);
62217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62219         this_ptr_conv.is_owned = false;
62220         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
62221         int64_t ret_ref = 0;
62222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62224         return ret_ref;
62225 }
62226
62227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62228         LDKNodeAnnouncementInfo this_ptr_conv;
62229         this_ptr_conv.inner = untag_ptr(this_ptr);
62230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62232         this_ptr_conv.is_owned = false;
62233         LDKNodeFeatures val_conv;
62234         val_conv.inner = untag_ptr(val);
62235         val_conv.is_owned = ptr_is_owned(val);
62236         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62237         val_conv = NodeFeatures_clone(&val_conv);
62238         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
62239 }
62240
62241 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
62242         LDKNodeAnnouncementInfo this_ptr_conv;
62243         this_ptr_conv.inner = untag_ptr(this_ptr);
62244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62246         this_ptr_conv.is_owned = false;
62247         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
62248         return ret_conv;
62249 }
62250
62251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62252         LDKNodeAnnouncementInfo this_ptr_conv;
62253         this_ptr_conv.inner = untag_ptr(this_ptr);
62254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62256         this_ptr_conv.is_owned = false;
62257         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
62258 }
62259
62260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
62261         LDKNodeAnnouncementInfo this_ptr_conv;
62262         this_ptr_conv.inner = untag_ptr(this_ptr);
62263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62265         this_ptr_conv.is_owned = false;
62266         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
62267         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
62268         return ret_arr;
62269 }
62270
62271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62272         LDKNodeAnnouncementInfo this_ptr_conv;
62273         this_ptr_conv.inner = untag_ptr(this_ptr);
62274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62276         this_ptr_conv.is_owned = false;
62277         LDKThreeBytes val_ref;
62278         CHECK((*env)->GetArrayLength(env, val) == 3);
62279         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
62280         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
62281 }
62282
62283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
62284         LDKNodeAnnouncementInfo this_ptr_conv;
62285         this_ptr_conv.inner = untag_ptr(this_ptr);
62286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62288         this_ptr_conv.is_owned = false;
62289         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
62290         int64_t ret_ref = 0;
62291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62293         return ret_ref;
62294 }
62295
62296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62297         LDKNodeAnnouncementInfo this_ptr_conv;
62298         this_ptr_conv.inner = untag_ptr(this_ptr);
62299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62301         this_ptr_conv.is_owned = false;
62302         LDKNodeAlias val_conv;
62303         val_conv.inner = untag_ptr(val);
62304         val_conv.is_owned = ptr_is_owned(val);
62305         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62306         val_conv = NodeAlias_clone(&val_conv);
62307         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
62308 }
62309
62310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
62311         LDKNodeAnnouncementInfo this_ptr_conv;
62312         this_ptr_conv.inner = untag_ptr(this_ptr);
62313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62315         this_ptr_conv.is_owned = false;
62316         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
62317         int64_t ret_ref = 0;
62318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62320         return ret_ref;
62321 }
62322
62323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62324         LDKNodeAnnouncementInfo this_ptr_conv;
62325         this_ptr_conv.inner = untag_ptr(this_ptr);
62326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62328         this_ptr_conv.is_owned = false;
62329         LDKNodeAnnouncement val_conv;
62330         val_conv.inner = untag_ptr(val);
62331         val_conv.is_owned = ptr_is_owned(val);
62332         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62333         val_conv = NodeAnnouncement_clone(&val_conv);
62334         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
62335 }
62336
62337 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, int64_t alias_arg, int64_t announcement_message_arg) {
62338         LDKNodeFeatures features_arg_conv;
62339         features_arg_conv.inner = untag_ptr(features_arg);
62340         features_arg_conv.is_owned = ptr_is_owned(features_arg);
62341         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
62342         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
62343         LDKThreeBytes rgb_arg_ref;
62344         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
62345         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
62346         LDKNodeAlias alias_arg_conv;
62347         alias_arg_conv.inner = untag_ptr(alias_arg);
62348         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
62349         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
62350         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
62351         LDKNodeAnnouncement announcement_message_arg_conv;
62352         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
62353         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
62354         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
62355         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
62356         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
62357         int64_t ret_ref = 0;
62358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62360         return ret_ref;
62361 }
62362
62363 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
62364         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
62365         int64_t ret_ref = 0;
62366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62368         return ret_ref;
62369 }
62370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62371         LDKNodeAnnouncementInfo arg_conv;
62372         arg_conv.inner = untag_ptr(arg);
62373         arg_conv.is_owned = ptr_is_owned(arg);
62374         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62375         arg_conv.is_owned = false;
62376         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
62377         return ret_conv;
62378 }
62379
62380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62381         LDKNodeAnnouncementInfo orig_conv;
62382         orig_conv.inner = untag_ptr(orig);
62383         orig_conv.is_owned = ptr_is_owned(orig);
62384         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62385         orig_conv.is_owned = false;
62386         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
62387         int64_t ret_ref = 0;
62388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62390         return ret_ref;
62391 }
62392
62393 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62394         LDKNodeAnnouncementInfo a_conv;
62395         a_conv.inner = untag_ptr(a);
62396         a_conv.is_owned = ptr_is_owned(a);
62397         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62398         a_conv.is_owned = false;
62399         LDKNodeAnnouncementInfo b_conv;
62400         b_conv.inner = untag_ptr(b);
62401         b_conv.is_owned = ptr_is_owned(b);
62402         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62403         b_conv.is_owned = false;
62404         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
62405         return ret_conv;
62406 }
62407
62408 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
62409         LDKNodeAnnouncementInfo this_arg_conv;
62410         this_arg_conv.inner = untag_ptr(this_arg);
62411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62413         this_arg_conv.is_owned = false;
62414         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
62415         int64_tArray ret_arr = NULL;
62416         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
62417         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
62418         for (size_t p = 0; p < ret_var.datalen; p++) {
62419                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
62420                 *ret_conv_15_copy = ret_var.data[p];
62421                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
62422                 ret_arr_ptr[p] = ret_conv_15_ref;
62423         }
62424         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
62425         FREE(ret_var.data);
62426         return ret_arr;
62427 }
62428
62429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
62430         LDKNodeAnnouncementInfo obj_conv;
62431         obj_conv.inner = untag_ptr(obj);
62432         obj_conv.is_owned = ptr_is_owned(obj);
62433         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62434         obj_conv.is_owned = false;
62435         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
62436         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62437         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62438         CVec_u8Z_free(ret_var);
62439         return ret_arr;
62440 }
62441
62442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62443         LDKu8slice ser_ref;
62444         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62445         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62446         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
62447         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
62448         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62449         return tag_ptr(ret_conv, true);
62450 }
62451
62452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62453         LDKNodeAlias this_obj_conv;
62454         this_obj_conv.inner = untag_ptr(this_obj);
62455         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62457         NodeAlias_free(this_obj_conv);
62458 }
62459
62460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
62461         LDKNodeAlias this_ptr_conv;
62462         this_ptr_conv.inner = untag_ptr(this_ptr);
62463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62465         this_ptr_conv.is_owned = false;
62466         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62467         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
62468         return ret_arr;
62469 }
62470
62471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62472         LDKNodeAlias this_ptr_conv;
62473         this_ptr_conv.inner = untag_ptr(this_ptr);
62474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62476         this_ptr_conv.is_owned = false;
62477         LDKThirtyTwoBytes val_ref;
62478         CHECK((*env)->GetArrayLength(env, val) == 32);
62479         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
62480         NodeAlias_set_a(&this_ptr_conv, val_ref);
62481 }
62482
62483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
62484         LDKThirtyTwoBytes a_arg_ref;
62485         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
62486         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
62487         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
62488         int64_t ret_ref = 0;
62489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62491         return ret_ref;
62492 }
62493
62494 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
62495         LDKNodeAlias ret_var = NodeAlias_clone(arg);
62496         int64_t ret_ref = 0;
62497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62499         return ret_ref;
62500 }
62501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62502         LDKNodeAlias arg_conv;
62503         arg_conv.inner = untag_ptr(arg);
62504         arg_conv.is_owned = ptr_is_owned(arg);
62505         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62506         arg_conv.is_owned = false;
62507         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
62508         return ret_conv;
62509 }
62510
62511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62512         LDKNodeAlias orig_conv;
62513         orig_conv.inner = untag_ptr(orig);
62514         orig_conv.is_owned = ptr_is_owned(orig);
62515         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62516         orig_conv.is_owned = false;
62517         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
62518         int64_t ret_ref = 0;
62519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62521         return ret_ref;
62522 }
62523
62524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62525         LDKNodeAlias a_conv;
62526         a_conv.inner = untag_ptr(a);
62527         a_conv.is_owned = ptr_is_owned(a);
62528         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62529         a_conv.is_owned = false;
62530         LDKNodeAlias b_conv;
62531         b_conv.inner = untag_ptr(b);
62532         b_conv.is_owned = ptr_is_owned(b);
62533         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62534         b_conv.is_owned = false;
62535         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
62536         return ret_conv;
62537 }
62538
62539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
62540         LDKNodeAlias obj_conv;
62541         obj_conv.inner = untag_ptr(obj);
62542         obj_conv.is_owned = ptr_is_owned(obj);
62543         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62544         obj_conv.is_owned = false;
62545         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
62546         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62547         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62548         CVec_u8Z_free(ret_var);
62549         return ret_arr;
62550 }
62551
62552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62553         LDKu8slice ser_ref;
62554         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62555         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62556         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
62557         *ret_conv = NodeAlias_read(ser_ref);
62558         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62559         return tag_ptr(ret_conv, true);
62560 }
62561
62562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62563         LDKNodeInfo this_obj_conv;
62564         this_obj_conv.inner = untag_ptr(this_obj);
62565         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62567         NodeInfo_free(this_obj_conv);
62568 }
62569
62570 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
62571         LDKNodeInfo this_ptr_conv;
62572         this_ptr_conv.inner = untag_ptr(this_ptr);
62573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62575         this_ptr_conv.is_owned = false;
62576         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
62577         int64_tArray ret_arr = NULL;
62578         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
62579         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
62580         for (size_t g = 0; g < ret_var.datalen; g++) {
62581                 int64_t ret_conv_6_conv = ret_var.data[g];
62582                 ret_arr_ptr[g] = ret_conv_6_conv;
62583         }
62584         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
62585         FREE(ret_var.data);
62586         return ret_arr;
62587 }
62588
62589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
62590         LDKNodeInfo this_ptr_conv;
62591         this_ptr_conv.inner = untag_ptr(this_ptr);
62592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62594         this_ptr_conv.is_owned = false;
62595         LDKCVec_u64Z val_constr;
62596         val_constr.datalen = (*env)->GetArrayLength(env, val);
62597         if (val_constr.datalen > 0)
62598                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
62599         else
62600                 val_constr.data = NULL;
62601         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
62602         for (size_t g = 0; g < val_constr.datalen; g++) {
62603                 int64_t val_conv_6 = val_vals[g];
62604                 val_constr.data[g] = val_conv_6;
62605         }
62606         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
62607         NodeInfo_set_channels(&this_ptr_conv, val_constr);
62608 }
62609
62610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
62611         LDKNodeInfo this_ptr_conv;
62612         this_ptr_conv.inner = untag_ptr(this_ptr);
62613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62615         this_ptr_conv.is_owned = false;
62616         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
62617         int64_t ret_ref = 0;
62618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62620         return ret_ref;
62621 }
62622
62623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62624         LDKNodeInfo this_ptr_conv;
62625         this_ptr_conv.inner = untag_ptr(this_ptr);
62626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62628         this_ptr_conv.is_owned = false;
62629         LDKNodeAnnouncementInfo val_conv;
62630         val_conv.inner = untag_ptr(val);
62631         val_conv.is_owned = ptr_is_owned(val);
62632         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62633         val_conv = NodeAnnouncementInfo_clone(&val_conv);
62634         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
62635 }
62636
62637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
62638         LDKCVec_u64Z channels_arg_constr;
62639         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
62640         if (channels_arg_constr.datalen > 0)
62641                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
62642         else
62643                 channels_arg_constr.data = NULL;
62644         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
62645         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
62646                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
62647                 channels_arg_constr.data[g] = channels_arg_conv_6;
62648         }
62649         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
62650         LDKNodeAnnouncementInfo announcement_info_arg_conv;
62651         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
62652         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
62653         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
62654         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
62655         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
62656         int64_t ret_ref = 0;
62657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62659         return ret_ref;
62660 }
62661
62662 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
62663         LDKNodeInfo ret_var = NodeInfo_clone(arg);
62664         int64_t ret_ref = 0;
62665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62667         return ret_ref;
62668 }
62669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62670         LDKNodeInfo arg_conv;
62671         arg_conv.inner = untag_ptr(arg);
62672         arg_conv.is_owned = ptr_is_owned(arg);
62673         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62674         arg_conv.is_owned = false;
62675         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
62676         return ret_conv;
62677 }
62678
62679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62680         LDKNodeInfo orig_conv;
62681         orig_conv.inner = untag_ptr(orig);
62682         orig_conv.is_owned = ptr_is_owned(orig);
62683         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62684         orig_conv.is_owned = false;
62685         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
62686         int64_t ret_ref = 0;
62687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62689         return ret_ref;
62690 }
62691
62692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62693         LDKNodeInfo a_conv;
62694         a_conv.inner = untag_ptr(a);
62695         a_conv.is_owned = ptr_is_owned(a);
62696         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62697         a_conv.is_owned = false;
62698         LDKNodeInfo b_conv;
62699         b_conv.inner = untag_ptr(b);
62700         b_conv.is_owned = ptr_is_owned(b);
62701         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62702         b_conv.is_owned = false;
62703         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
62704         return ret_conv;
62705 }
62706
62707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
62708         LDKNodeInfo obj_conv;
62709         obj_conv.inner = untag_ptr(obj);
62710         obj_conv.is_owned = ptr_is_owned(obj);
62711         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62712         obj_conv.is_owned = false;
62713         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
62714         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62715         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62716         CVec_u8Z_free(ret_var);
62717         return ret_arr;
62718 }
62719
62720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62721         LDKu8slice ser_ref;
62722         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62723         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62724         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
62725         *ret_conv = NodeInfo_read(ser_ref);
62726         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62727         return tag_ptr(ret_conv, true);
62728 }
62729
62730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
62731         LDKNetworkGraph obj_conv;
62732         obj_conv.inner = untag_ptr(obj);
62733         obj_conv.is_owned = ptr_is_owned(obj);
62734         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62735         obj_conv.is_owned = false;
62736         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
62737         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62738         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62739         CVec_u8Z_free(ret_var);
62740         return ret_arr;
62741 }
62742
62743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
62744         LDKu8slice ser_ref;
62745         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62746         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62747         void* arg_ptr = untag_ptr(arg);
62748         CHECK_ACCESS(arg_ptr);
62749         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
62750         if (arg_conv.free == LDKLogger_JCalls_free) {
62751                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62752                 LDKLogger_JCalls_cloned(&arg_conv);
62753         }
62754         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
62755         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
62756         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62757         return tag_ptr(ret_conv, true);
62758 }
62759
62760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
62761         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
62762         void* logger_ptr = untag_ptr(logger);
62763         CHECK_ACCESS(logger_ptr);
62764         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62765         if (logger_conv.free == LDKLogger_JCalls_free) {
62766                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62767                 LDKLogger_JCalls_cloned(&logger_conv);
62768         }
62769         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
62770         int64_t ret_ref = 0;
62771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62773         return ret_ref;
62774 }
62775
62776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
62777         LDKNetworkGraph this_arg_conv;
62778         this_arg_conv.inner = untag_ptr(this_arg);
62779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62781         this_arg_conv.is_owned = false;
62782         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
62783         int64_t ret_ref = 0;
62784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62786         return ret_ref;
62787 }
62788
62789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
62790         LDKNetworkGraph this_arg_conv;
62791         this_arg_conv.inner = untag_ptr(this_arg);
62792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62794         this_arg_conv.is_owned = false;
62795         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
62796         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
62797         int64_t ret_ref = tag_ptr(ret_copy, true);
62798         return ret_ref;
62799 }
62800
62801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1set_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
62802         LDKNetworkGraph this_arg_conv;
62803         this_arg_conv.inner = untag_ptr(this_arg);
62804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62806         this_arg_conv.is_owned = false;
62807         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
62808 }
62809
62810 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) {
62811         LDKNetworkGraph this_arg_conv;
62812         this_arg_conv.inner = untag_ptr(this_arg);
62813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62815         this_arg_conv.is_owned = false;
62816         LDKNodeAnnouncement msg_conv;
62817         msg_conv.inner = untag_ptr(msg);
62818         msg_conv.is_owned = ptr_is_owned(msg);
62819         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62820         msg_conv.is_owned = false;
62821         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62822         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
62823         return tag_ptr(ret_conv, true);
62824 }
62825
62826 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) {
62827         LDKNetworkGraph this_arg_conv;
62828         this_arg_conv.inner = untag_ptr(this_arg);
62829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62831         this_arg_conv.is_owned = false;
62832         LDKUnsignedNodeAnnouncement msg_conv;
62833         msg_conv.inner = untag_ptr(msg);
62834         msg_conv.is_owned = ptr_is_owned(msg);
62835         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62836         msg_conv.is_owned = false;
62837         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62838         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
62839         return tag_ptr(ret_conv, true);
62840 }
62841
62842 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 utxo_lookup) {
62843         LDKNetworkGraph this_arg_conv;
62844         this_arg_conv.inner = untag_ptr(this_arg);
62845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62847         this_arg_conv.is_owned = false;
62848         LDKChannelAnnouncement msg_conv;
62849         msg_conv.inner = untag_ptr(msg);
62850         msg_conv.is_owned = ptr_is_owned(msg);
62851         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62852         msg_conv.is_owned = false;
62853         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62854         CHECK_ACCESS(utxo_lookup_ptr);
62855         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62856         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62857         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62858                 // Manually implement clone for Java trait instances
62859                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62860                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62861                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62862                 }
62863         }
62864         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62865         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
62866         return tag_ptr(ret_conv, true);
62867 }
62868
62869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement_1no_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
62870         LDKNetworkGraph this_arg_conv;
62871         this_arg_conv.inner = untag_ptr(this_arg);
62872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62874         this_arg_conv.is_owned = false;
62875         LDKChannelAnnouncement msg_conv;
62876         msg_conv.inner = untag_ptr(msg);
62877         msg_conv.is_owned = ptr_is_owned(msg);
62878         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62879         msg_conv.is_owned = false;
62880         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62881         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
62882         return tag_ptr(ret_conv, true);
62883 }
62884
62885 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 utxo_lookup) {
62886         LDKNetworkGraph this_arg_conv;
62887         this_arg_conv.inner = untag_ptr(this_arg);
62888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62890         this_arg_conv.is_owned = false;
62891         LDKUnsignedChannelAnnouncement msg_conv;
62892         msg_conv.inner = untag_ptr(msg);
62893         msg_conv.is_owned = ptr_is_owned(msg);
62894         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62895         msg_conv.is_owned = false;
62896         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62897         CHECK_ACCESS(utxo_lookup_ptr);
62898         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62899         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62900         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62901                 // Manually implement clone for Java trait instances
62902                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62903                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62904                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62905                 }
62906         }
62907         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62908         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
62909         return tag_ptr(ret_conv, true);
62910 }
62911
62912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1add_1channel_1from_1partial_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t timestamp, int64_t features, int8_tArray node_id_1, int8_tArray node_id_2) {
62913         LDKNetworkGraph this_arg_conv;
62914         this_arg_conv.inner = untag_ptr(this_arg);
62915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62917         this_arg_conv.is_owned = false;
62918         LDKChannelFeatures features_conv;
62919         features_conv.inner = untag_ptr(features);
62920         features_conv.is_owned = ptr_is_owned(features);
62921         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
62922         features_conv = ChannelFeatures_clone(&features_conv);
62923         LDKPublicKey node_id_1_ref;
62924         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
62925         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
62926         LDKPublicKey node_id_2_ref;
62927         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
62928         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
62929         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62930         *ret_conv = NetworkGraph_add_channel_from_partial_announcement(&this_arg_conv, short_channel_id, timestamp, features_conv, node_id_1_ref, node_id_2_ref);
62931         return tag_ptr(ret_conv, true);
62932 }
62933
62934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1channel_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
62935         LDKNetworkGraph this_arg_conv;
62936         this_arg_conv.inner = untag_ptr(this_arg);
62937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62939         this_arg_conv.is_owned = false;
62940         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
62941 }
62942
62943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
62944         LDKNetworkGraph this_arg_conv;
62945         this_arg_conv.inner = untag_ptr(this_arg);
62946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62948         this_arg_conv.is_owned = false;
62949         LDKPublicKey node_id_ref;
62950         CHECK((*env)->GetArrayLength(env, node_id) == 33);
62951         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
62952         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
62953 }
62954
62955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
62956         LDKNetworkGraph this_arg_conv;
62957         this_arg_conv.inner = untag_ptr(this_arg);
62958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62960         this_arg_conv.is_owned = false;
62961         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
62962 }
62963
62964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) {
62965         LDKNetworkGraph this_arg_conv;
62966         this_arg_conv.inner = untag_ptr(this_arg);
62967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62969         this_arg_conv.is_owned = false;
62970         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
62971 }
62972
62973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
62974         LDKNetworkGraph this_arg_conv;
62975         this_arg_conv.inner = untag_ptr(this_arg);
62976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62978         this_arg_conv.is_owned = false;
62979         LDKChannelUpdate msg_conv;
62980         msg_conv.inner = untag_ptr(msg);
62981         msg_conv.is_owned = ptr_is_owned(msg);
62982         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62983         msg_conv.is_owned = false;
62984         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62985         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
62986         return tag_ptr(ret_conv, true);
62987 }
62988
62989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
62990         LDKNetworkGraph this_arg_conv;
62991         this_arg_conv.inner = untag_ptr(this_arg);
62992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62994         this_arg_conv.is_owned = false;
62995         LDKUnsignedChannelUpdate msg_conv;
62996         msg_conv.inner = untag_ptr(msg);
62997         msg_conv.is_owned = ptr_is_owned(msg);
62998         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62999         msg_conv.is_owned = false;
63000         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63001         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
63002         return tag_ptr(ret_conv, true);
63003 }
63004
63005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
63006         LDKReadOnlyNetworkGraph this_arg_conv;
63007         this_arg_conv.inner = untag_ptr(this_arg);
63008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63010         this_arg_conv.is_owned = false;
63011         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
63012         int64_t ret_ref = 0;
63013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63015         return ret_ref;
63016 }
63017
63018 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
63019         LDKReadOnlyNetworkGraph this_arg_conv;
63020         this_arg_conv.inner = untag_ptr(this_arg);
63021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63023         this_arg_conv.is_owned = false;
63024         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
63025         int64_tArray ret_arr = NULL;
63026         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63027         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63028         for (size_t g = 0; g < ret_var.datalen; g++) {
63029                 int64_t ret_conv_6_conv = ret_var.data[g];
63030                 ret_arr_ptr[g] = ret_conv_6_conv;
63031         }
63032         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63033         FREE(ret_var.data);
63034         return ret_arr;
63035 }
63036
63037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
63038         LDKReadOnlyNetworkGraph this_arg_conv;
63039         this_arg_conv.inner = untag_ptr(this_arg);
63040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63042         this_arg_conv.is_owned = false;
63043         LDKNodeId node_id_conv;
63044         node_id_conv.inner = untag_ptr(node_id);
63045         node_id_conv.is_owned = ptr_is_owned(node_id);
63046         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
63047         node_id_conv.is_owned = false;
63048         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
63049         int64_t ret_ref = 0;
63050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63052         return ret_ref;
63053 }
63054
63055 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
63056         LDKReadOnlyNetworkGraph this_arg_conv;
63057         this_arg_conv.inner = untag_ptr(this_arg);
63058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63060         this_arg_conv.is_owned = false;
63061         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
63062         int64_tArray ret_arr = NULL;
63063         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63064         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63065         for (size_t i = 0; i < ret_var.datalen; i++) {
63066                 LDKNodeId ret_conv_8_var = ret_var.data[i];
63067                 int64_t ret_conv_8_ref = 0;
63068                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
63069                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
63070                 ret_arr_ptr[i] = ret_conv_8_ref;
63071         }
63072         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63073         FREE(ret_var.data);
63074         return ret_arr;
63075 }
63076
63077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
63078         LDKReadOnlyNetworkGraph this_arg_conv;
63079         this_arg_conv.inner = untag_ptr(this_arg);
63080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63082         this_arg_conv.is_owned = false;
63083         LDKPublicKey pubkey_ref;
63084         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
63085         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
63086         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
63087         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
63088         int64_t ret_ref = tag_ptr(ret_copy, true);
63089         return ret_ref;
63090 }
63091
63092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63093         LDKDefaultRouter this_obj_conv;
63094         this_obj_conv.inner = untag_ptr(this_obj);
63095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63097         DefaultRouter_free(this_obj_conv);
63098 }
63099
63100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes, int64_t scorer, int64_t score_params) {
63101         LDKNetworkGraph network_graph_conv;
63102         network_graph_conv.inner = untag_ptr(network_graph);
63103         network_graph_conv.is_owned = ptr_is_owned(network_graph);
63104         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
63105         network_graph_conv.is_owned = false;
63106         void* logger_ptr = untag_ptr(logger);
63107         CHECK_ACCESS(logger_ptr);
63108         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63109         if (logger_conv.free == LDKLogger_JCalls_free) {
63110                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63111                 LDKLogger_JCalls_cloned(&logger_conv);
63112         }
63113         LDKThirtyTwoBytes random_seed_bytes_ref;
63114         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
63115         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
63116         void* scorer_ptr = untag_ptr(scorer);
63117         CHECK_ACCESS(scorer_ptr);
63118         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
63119         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
63120                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63121                 LDKLockableScore_JCalls_cloned(&scorer_conv);
63122         }
63123         LDKProbabilisticScoringFeeParameters score_params_conv;
63124         score_params_conv.inner = untag_ptr(score_params);
63125         score_params_conv.is_owned = ptr_is_owned(score_params);
63126         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
63127         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
63128         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
63129         int64_t ret_ref = 0;
63130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63132         return ret_ref;
63133 }
63134
63135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
63136         LDKDefaultRouter this_arg_conv;
63137         this_arg_conv.inner = untag_ptr(this_arg);
63138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63140         this_arg_conv.is_owned = false;
63141         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
63142         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
63143         return tag_ptr(ret_ret, true);
63144 }
63145
63146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63147         if (!ptr_is_owned(this_ptr)) return;
63148         void* this_ptr_ptr = untag_ptr(this_ptr);
63149         CHECK_ACCESS(this_ptr_ptr);
63150         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
63151         FREE(untag_ptr(this_ptr));
63152         Router_free(this_ptr_conv);
63153 }
63154
63155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63156         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
63157         this_obj_conv.inner = untag_ptr(this_obj);
63158         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63160         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
63161 }
63162
63163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
63164         void* scorer_ptr = untag_ptr(scorer);
63165         CHECK_ACCESS(scorer_ptr);
63166         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
63167         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
63168                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63169                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
63170         }
63171         LDKInFlightHtlcs inflight_htlcs_conv;
63172         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
63173         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
63174         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
63175         inflight_htlcs_conv.is_owned = false;
63176         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
63177         int64_t ret_ref = 0;
63178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63180         return ret_ref;
63181 }
63182
63183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
63184         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
63185         this_arg_conv.inner = untag_ptr(this_arg);
63186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63188         this_arg_conv.is_owned = false;
63189         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
63190         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
63191         return tag_ptr(ret_ret, true);
63192 }
63193
63194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63195         LDKInFlightHtlcs this_obj_conv;
63196         this_obj_conv.inner = untag_ptr(this_obj);
63197         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63199         InFlightHtlcs_free(this_obj_conv);
63200 }
63201
63202 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
63203         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
63204         int64_t ret_ref = 0;
63205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63207         return ret_ref;
63208 }
63209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63210         LDKInFlightHtlcs arg_conv;
63211         arg_conv.inner = untag_ptr(arg);
63212         arg_conv.is_owned = ptr_is_owned(arg);
63213         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63214         arg_conv.is_owned = false;
63215         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
63216         return ret_conv;
63217 }
63218
63219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63220         LDKInFlightHtlcs orig_conv;
63221         orig_conv.inner = untag_ptr(orig);
63222         orig_conv.is_owned = ptr_is_owned(orig);
63223         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63224         orig_conv.is_owned = false;
63225         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
63226         int64_t ret_ref = 0;
63227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63229         return ret_ref;
63230 }
63231
63232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
63233         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
63234         int64_t ret_ref = 0;
63235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63237         return ret_ref;
63238 }
63239
63240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1process_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int8_tArray payer_node_id) {
63241         LDKInFlightHtlcs this_arg_conv;
63242         this_arg_conv.inner = untag_ptr(this_arg);
63243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63245         this_arg_conv.is_owned = false;
63246         LDKPath path_conv;
63247         path_conv.inner = untag_ptr(path);
63248         path_conv.is_owned = ptr_is_owned(path);
63249         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63250         path_conv.is_owned = false;
63251         LDKPublicKey payer_node_id_ref;
63252         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
63253         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
63254         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
63255 }
63256
63257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1add_1inflight_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid, int64_t used_msat) {
63258         LDKInFlightHtlcs this_arg_conv;
63259         this_arg_conv.inner = untag_ptr(this_arg);
63260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63262         this_arg_conv.is_owned = false;
63263         LDKNodeId source_conv;
63264         source_conv.inner = untag_ptr(source);
63265         source_conv.is_owned = ptr_is_owned(source);
63266         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63267         source_conv.is_owned = false;
63268         LDKNodeId target_conv;
63269         target_conv.inner = untag_ptr(target);
63270         target_conv.is_owned = ptr_is_owned(target);
63271         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63272         target_conv.is_owned = false;
63273         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
63274 }
63275
63276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1used_1liquidity_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid) {
63277         LDKInFlightHtlcs this_arg_conv;
63278         this_arg_conv.inner = untag_ptr(this_arg);
63279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63281         this_arg_conv.is_owned = false;
63282         LDKNodeId source_conv;
63283         source_conv.inner = untag_ptr(source);
63284         source_conv.is_owned = ptr_is_owned(source);
63285         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63286         source_conv.is_owned = false;
63287         LDKNodeId target_conv;
63288         target_conv.inner = untag_ptr(target);
63289         target_conv.is_owned = ptr_is_owned(target);
63290         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63291         target_conv.is_owned = false;
63292         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63293         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
63294         int64_t ret_ref = tag_ptr(ret_copy, true);
63295         return ret_ref;
63296 }
63297
63298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
63299         LDKInFlightHtlcs obj_conv;
63300         obj_conv.inner = untag_ptr(obj);
63301         obj_conv.is_owned = ptr_is_owned(obj);
63302         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63303         obj_conv.is_owned = false;
63304         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
63305         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63306         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63307         CVec_u8Z_free(ret_var);
63308         return ret_arr;
63309 }
63310
63311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63312         LDKu8slice ser_ref;
63313         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63314         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63315         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
63316         *ret_conv = InFlightHtlcs_read(ser_ref);
63317         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63318         return tag_ptr(ret_conv, true);
63319 }
63320
63321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63322         LDKRouteHop this_obj_conv;
63323         this_obj_conv.inner = untag_ptr(this_obj);
63324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63326         RouteHop_free(this_obj_conv);
63327 }
63328
63329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
63330         LDKRouteHop this_ptr_conv;
63331         this_ptr_conv.inner = untag_ptr(this_ptr);
63332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63334         this_ptr_conv.is_owned = false;
63335         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
63336         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
63337         return ret_arr;
63338 }
63339
63340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63341         LDKRouteHop this_ptr_conv;
63342         this_ptr_conv.inner = untag_ptr(this_ptr);
63343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63345         this_ptr_conv.is_owned = false;
63346         LDKPublicKey val_ref;
63347         CHECK((*env)->GetArrayLength(env, val) == 33);
63348         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
63349         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
63350 }
63351
63352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
63353         LDKRouteHop this_ptr_conv;
63354         this_ptr_conv.inner = untag_ptr(this_ptr);
63355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63357         this_ptr_conv.is_owned = false;
63358         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
63359         int64_t ret_ref = 0;
63360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63362         return ret_ref;
63363 }
63364
63365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63366         LDKRouteHop this_ptr_conv;
63367         this_ptr_conv.inner = untag_ptr(this_ptr);
63368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63370         this_ptr_conv.is_owned = false;
63371         LDKNodeFeatures val_conv;
63372         val_conv.inner = untag_ptr(val);
63373         val_conv.is_owned = ptr_is_owned(val);
63374         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63375         val_conv = NodeFeatures_clone(&val_conv);
63376         RouteHop_set_node_features(&this_ptr_conv, val_conv);
63377 }
63378
63379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
63380         LDKRouteHop this_ptr_conv;
63381         this_ptr_conv.inner = untag_ptr(this_ptr);
63382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63384         this_ptr_conv.is_owned = false;
63385         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
63386         return ret_conv;
63387 }
63388
63389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63390         LDKRouteHop this_ptr_conv;
63391         this_ptr_conv.inner = untag_ptr(this_ptr);
63392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63394         this_ptr_conv.is_owned = false;
63395         RouteHop_set_short_channel_id(&this_ptr_conv, val);
63396 }
63397
63398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
63399         LDKRouteHop this_ptr_conv;
63400         this_ptr_conv.inner = untag_ptr(this_ptr);
63401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63403         this_ptr_conv.is_owned = false;
63404         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
63405         int64_t ret_ref = 0;
63406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63408         return ret_ref;
63409 }
63410
63411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63412         LDKRouteHop this_ptr_conv;
63413         this_ptr_conv.inner = untag_ptr(this_ptr);
63414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63416         this_ptr_conv.is_owned = false;
63417         LDKChannelFeatures val_conv;
63418         val_conv.inner = untag_ptr(val);
63419         val_conv.is_owned = ptr_is_owned(val);
63420         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63421         val_conv = ChannelFeatures_clone(&val_conv);
63422         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
63423 }
63424
63425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
63426         LDKRouteHop this_ptr_conv;
63427         this_ptr_conv.inner = untag_ptr(this_ptr);
63428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63430         this_ptr_conv.is_owned = false;
63431         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
63432         return ret_conv;
63433 }
63434
63435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63436         LDKRouteHop this_ptr_conv;
63437         this_ptr_conv.inner = untag_ptr(this_ptr);
63438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63440         this_ptr_conv.is_owned = false;
63441         RouteHop_set_fee_msat(&this_ptr_conv, val);
63442 }
63443
63444 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
63445         LDKRouteHop this_ptr_conv;
63446         this_ptr_conv.inner = untag_ptr(this_ptr);
63447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63449         this_ptr_conv.is_owned = false;
63450         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
63451         return ret_conv;
63452 }
63453
63454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
63455         LDKRouteHop this_ptr_conv;
63456         this_ptr_conv.inner = untag_ptr(this_ptr);
63457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63459         this_ptr_conv.is_owned = false;
63460         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
63461 }
63462
63463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
63464         LDKRouteHop this_ptr_conv;
63465         this_ptr_conv.inner = untag_ptr(this_ptr);
63466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63468         this_ptr_conv.is_owned = false;
63469         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
63470         return ret_conv;
63471 }
63472
63473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
63474         LDKRouteHop this_ptr_conv;
63475         this_ptr_conv.inner = untag_ptr(this_ptr);
63476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63478         this_ptr_conv.is_owned = false;
63479         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
63480 }
63481
63482 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, jboolean maybe_announced_channel_arg) {
63483         LDKPublicKey pubkey_arg_ref;
63484         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
63485         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
63486         LDKNodeFeatures node_features_arg_conv;
63487         node_features_arg_conv.inner = untag_ptr(node_features_arg);
63488         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
63489         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
63490         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
63491         LDKChannelFeatures channel_features_arg_conv;
63492         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
63493         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
63494         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
63495         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
63496         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, maybe_announced_channel_arg);
63497         int64_t ret_ref = 0;
63498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63500         return ret_ref;
63501 }
63502
63503 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
63504         LDKRouteHop ret_var = RouteHop_clone(arg);
63505         int64_t ret_ref = 0;
63506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63508         return ret_ref;
63509 }
63510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63511         LDKRouteHop arg_conv;
63512         arg_conv.inner = untag_ptr(arg);
63513         arg_conv.is_owned = ptr_is_owned(arg);
63514         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63515         arg_conv.is_owned = false;
63516         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
63517         return ret_conv;
63518 }
63519
63520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63521         LDKRouteHop orig_conv;
63522         orig_conv.inner = untag_ptr(orig);
63523         orig_conv.is_owned = ptr_is_owned(orig);
63524         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63525         orig_conv.is_owned = false;
63526         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
63527         int64_t ret_ref = 0;
63528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63530         return ret_ref;
63531 }
63532
63533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
63534         LDKRouteHop o_conv;
63535         o_conv.inner = untag_ptr(o);
63536         o_conv.is_owned = ptr_is_owned(o);
63537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63538         o_conv.is_owned = false;
63539         int64_t ret_conv = RouteHop_hash(&o_conv);
63540         return ret_conv;
63541 }
63542
63543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63544         LDKRouteHop a_conv;
63545         a_conv.inner = untag_ptr(a);
63546         a_conv.is_owned = ptr_is_owned(a);
63547         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63548         a_conv.is_owned = false;
63549         LDKRouteHop b_conv;
63550         b_conv.inner = untag_ptr(b);
63551         b_conv.is_owned = ptr_is_owned(b);
63552         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63553         b_conv.is_owned = false;
63554         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
63555         return ret_conv;
63556 }
63557
63558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
63559         LDKRouteHop obj_conv;
63560         obj_conv.inner = untag_ptr(obj);
63561         obj_conv.is_owned = ptr_is_owned(obj);
63562         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63563         obj_conv.is_owned = false;
63564         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
63565         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63566         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63567         CVec_u8Z_free(ret_var);
63568         return ret_arr;
63569 }
63570
63571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63572         LDKu8slice ser_ref;
63573         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63574         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63575         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
63576         *ret_conv = RouteHop_read(ser_ref);
63577         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63578         return tag_ptr(ret_conv, true);
63579 }
63580
63581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63582         LDKBlindedTail this_obj_conv;
63583         this_obj_conv.inner = untag_ptr(this_obj);
63584         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63586         BlindedTail_free(this_obj_conv);
63587 }
63588
63589 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
63590         LDKBlindedTail this_ptr_conv;
63591         this_ptr_conv.inner = untag_ptr(this_ptr);
63592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63594         this_ptr_conv.is_owned = false;
63595         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
63596         int64_tArray ret_arr = NULL;
63597         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63598         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63599         for (size_t m = 0; m < ret_var.datalen; m++) {
63600                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
63601                 int64_t ret_conv_12_ref = 0;
63602                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
63603                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
63604                 ret_arr_ptr[m] = ret_conv_12_ref;
63605         }
63606         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63607         FREE(ret_var.data);
63608         return ret_arr;
63609 }
63610
63611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
63612         LDKBlindedTail this_ptr_conv;
63613         this_ptr_conv.inner = untag_ptr(this_ptr);
63614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63616         this_ptr_conv.is_owned = false;
63617         LDKCVec_BlindedHopZ val_constr;
63618         val_constr.datalen = (*env)->GetArrayLength(env, val);
63619         if (val_constr.datalen > 0)
63620                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
63621         else
63622                 val_constr.data = NULL;
63623         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
63624         for (size_t m = 0; m < val_constr.datalen; m++) {
63625                 int64_t val_conv_12 = val_vals[m];
63626                 LDKBlindedHop val_conv_12_conv;
63627                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
63628                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
63629                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
63630                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
63631                 val_constr.data[m] = val_conv_12_conv;
63632         }
63633         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
63634         BlindedTail_set_hops(&this_ptr_conv, val_constr);
63635 }
63636
63637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
63638         LDKBlindedTail this_ptr_conv;
63639         this_ptr_conv.inner = untag_ptr(this_ptr);
63640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63642         this_ptr_conv.is_owned = false;
63643         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
63644         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
63645         return ret_arr;
63646 }
63647
63648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63649         LDKBlindedTail this_ptr_conv;
63650         this_ptr_conv.inner = untag_ptr(this_ptr);
63651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63653         this_ptr_conv.is_owned = false;
63654         LDKPublicKey val_ref;
63655         CHECK((*env)->GetArrayLength(env, val) == 33);
63656         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
63657         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
63658 }
63659
63660 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
63661         LDKBlindedTail this_ptr_conv;
63662         this_ptr_conv.inner = untag_ptr(this_ptr);
63663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63665         this_ptr_conv.is_owned = false;
63666         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
63667         return ret_conv;
63668 }
63669
63670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
63671         LDKBlindedTail this_ptr_conv;
63672         this_ptr_conv.inner = untag_ptr(this_ptr);
63673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63675         this_ptr_conv.is_owned = false;
63676         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
63677 }
63678
63679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
63680         LDKBlindedTail this_ptr_conv;
63681         this_ptr_conv.inner = untag_ptr(this_ptr);
63682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63684         this_ptr_conv.is_owned = false;
63685         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
63686         return ret_conv;
63687 }
63688
63689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63690         LDKBlindedTail this_ptr_conv;
63691         this_ptr_conv.inner = untag_ptr(this_ptr);
63692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63694         this_ptr_conv.is_owned = false;
63695         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
63696 }
63697
63698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int8_tArray blinding_point_arg, int32_t excess_final_cltv_expiry_delta_arg, int64_t final_value_msat_arg) {
63699         LDKCVec_BlindedHopZ hops_arg_constr;
63700         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
63701         if (hops_arg_constr.datalen > 0)
63702                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
63703         else
63704                 hops_arg_constr.data = NULL;
63705         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
63706         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
63707                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
63708                 LDKBlindedHop hops_arg_conv_12_conv;
63709                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
63710                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
63711                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
63712                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
63713                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
63714         }
63715         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
63716         LDKPublicKey blinding_point_arg_ref;
63717         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
63718         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
63719         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
63720         int64_t ret_ref = 0;
63721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63723         return ret_ref;
63724 }
63725
63726 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
63727         LDKBlindedTail ret_var = BlindedTail_clone(arg);
63728         int64_t ret_ref = 0;
63729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63731         return ret_ref;
63732 }
63733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63734         LDKBlindedTail arg_conv;
63735         arg_conv.inner = untag_ptr(arg);
63736         arg_conv.is_owned = ptr_is_owned(arg);
63737         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63738         arg_conv.is_owned = false;
63739         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
63740         return ret_conv;
63741 }
63742
63743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63744         LDKBlindedTail orig_conv;
63745         orig_conv.inner = untag_ptr(orig);
63746         orig_conv.is_owned = ptr_is_owned(orig);
63747         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63748         orig_conv.is_owned = false;
63749         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
63750         int64_t ret_ref = 0;
63751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63753         return ret_ref;
63754 }
63755
63756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
63757         LDKBlindedTail o_conv;
63758         o_conv.inner = untag_ptr(o);
63759         o_conv.is_owned = ptr_is_owned(o);
63760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63761         o_conv.is_owned = false;
63762         int64_t ret_conv = BlindedTail_hash(&o_conv);
63763         return ret_conv;
63764 }
63765
63766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63767         LDKBlindedTail a_conv;
63768         a_conv.inner = untag_ptr(a);
63769         a_conv.is_owned = ptr_is_owned(a);
63770         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63771         a_conv.is_owned = false;
63772         LDKBlindedTail b_conv;
63773         b_conv.inner = untag_ptr(b);
63774         b_conv.is_owned = ptr_is_owned(b);
63775         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63776         b_conv.is_owned = false;
63777         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
63778         return ret_conv;
63779 }
63780
63781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
63782         LDKBlindedTail obj_conv;
63783         obj_conv.inner = untag_ptr(obj);
63784         obj_conv.is_owned = ptr_is_owned(obj);
63785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63786         obj_conv.is_owned = false;
63787         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
63788         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63789         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63790         CVec_u8Z_free(ret_var);
63791         return ret_arr;
63792 }
63793
63794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63795         LDKu8slice ser_ref;
63796         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63797         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63798         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
63799         *ret_conv = BlindedTail_read(ser_ref);
63800         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63801         return tag_ptr(ret_conv, true);
63802 }
63803
63804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63805         LDKPath this_obj_conv;
63806         this_obj_conv.inner = untag_ptr(this_obj);
63807         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63809         Path_free(this_obj_conv);
63810 }
63811
63812 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
63813         LDKPath this_ptr_conv;
63814         this_ptr_conv.inner = untag_ptr(this_ptr);
63815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63817         this_ptr_conv.is_owned = false;
63818         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
63819         int64_tArray ret_arr = NULL;
63820         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63821         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63822         for (size_t k = 0; k < ret_var.datalen; k++) {
63823                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
63824                 int64_t ret_conv_10_ref = 0;
63825                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
63826                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
63827                 ret_arr_ptr[k] = ret_conv_10_ref;
63828         }
63829         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63830         FREE(ret_var.data);
63831         return ret_arr;
63832 }
63833
63834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
63835         LDKPath this_ptr_conv;
63836         this_ptr_conv.inner = untag_ptr(this_ptr);
63837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63839         this_ptr_conv.is_owned = false;
63840         LDKCVec_RouteHopZ val_constr;
63841         val_constr.datalen = (*env)->GetArrayLength(env, val);
63842         if (val_constr.datalen > 0)
63843                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
63844         else
63845                 val_constr.data = NULL;
63846         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
63847         for (size_t k = 0; k < val_constr.datalen; k++) {
63848                 int64_t val_conv_10 = val_vals[k];
63849                 LDKRouteHop val_conv_10_conv;
63850                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
63851                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
63852                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
63853                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
63854                 val_constr.data[k] = val_conv_10_conv;
63855         }
63856         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
63857         Path_set_hops(&this_ptr_conv, val_constr);
63858 }
63859
63860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
63861         LDKPath this_ptr_conv;
63862         this_ptr_conv.inner = untag_ptr(this_ptr);
63863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63865         this_ptr_conv.is_owned = false;
63866         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
63867         int64_t ret_ref = 0;
63868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63870         return ret_ref;
63871 }
63872
63873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63874         LDKPath this_ptr_conv;
63875         this_ptr_conv.inner = untag_ptr(this_ptr);
63876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63878         this_ptr_conv.is_owned = false;
63879         LDKBlindedTail val_conv;
63880         val_conv.inner = untag_ptr(val);
63881         val_conv.is_owned = ptr_is_owned(val);
63882         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63883         val_conv = BlindedTail_clone(&val_conv);
63884         Path_set_blinded_tail(&this_ptr_conv, val_conv);
63885 }
63886
63887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
63888         LDKCVec_RouteHopZ hops_arg_constr;
63889         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
63890         if (hops_arg_constr.datalen > 0)
63891                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
63892         else
63893                 hops_arg_constr.data = NULL;
63894         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
63895         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
63896                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
63897                 LDKRouteHop hops_arg_conv_10_conv;
63898                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
63899                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
63900                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
63901                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
63902                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
63903         }
63904         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
63905         LDKBlindedTail blinded_tail_arg_conv;
63906         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
63907         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
63908         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
63909         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
63910         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
63911         int64_t ret_ref = 0;
63912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63914         return ret_ref;
63915 }
63916
63917 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
63918         LDKPath ret_var = Path_clone(arg);
63919         int64_t ret_ref = 0;
63920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63922         return ret_ref;
63923 }
63924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63925         LDKPath arg_conv;
63926         arg_conv.inner = untag_ptr(arg);
63927         arg_conv.is_owned = ptr_is_owned(arg);
63928         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63929         arg_conv.is_owned = false;
63930         int64_t ret_conv = Path_clone_ptr(&arg_conv);
63931         return ret_conv;
63932 }
63933
63934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63935         LDKPath orig_conv;
63936         orig_conv.inner = untag_ptr(orig);
63937         orig_conv.is_owned = ptr_is_owned(orig);
63938         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63939         orig_conv.is_owned = false;
63940         LDKPath ret_var = Path_clone(&orig_conv);
63941         int64_t ret_ref = 0;
63942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63944         return ret_ref;
63945 }
63946
63947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
63948         LDKPath o_conv;
63949         o_conv.inner = untag_ptr(o);
63950         o_conv.is_owned = ptr_is_owned(o);
63951         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63952         o_conv.is_owned = false;
63953         int64_t ret_conv = Path_hash(&o_conv);
63954         return ret_conv;
63955 }
63956
63957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63958         LDKPath a_conv;
63959         a_conv.inner = untag_ptr(a);
63960         a_conv.is_owned = ptr_is_owned(a);
63961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63962         a_conv.is_owned = false;
63963         LDKPath b_conv;
63964         b_conv.inner = untag_ptr(b);
63965         b_conv.is_owned = ptr_is_owned(b);
63966         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63967         b_conv.is_owned = false;
63968         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
63969         return ret_conv;
63970 }
63971
63972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
63973         LDKPath this_arg_conv;
63974         this_arg_conv.inner = untag_ptr(this_arg);
63975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63977         this_arg_conv.is_owned = false;
63978         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
63979         return ret_conv;
63980 }
63981
63982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
63983         LDKPath this_arg_conv;
63984         this_arg_conv.inner = untag_ptr(this_arg);
63985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63987         this_arg_conv.is_owned = false;
63988         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
63989         return ret_conv;
63990 }
63991
63992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
63993         LDKPath this_arg_conv;
63994         this_arg_conv.inner = untag_ptr(this_arg);
63995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63997         this_arg_conv.is_owned = false;
63998         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63999         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
64000         int64_t ret_ref = tag_ptr(ret_copy, true);
64001         return ret_ref;
64002 }
64003
64004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64005         LDKRoute this_obj_conv;
64006         this_obj_conv.inner = untag_ptr(this_obj);
64007         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64009         Route_free(this_obj_conv);
64010 }
64011
64012 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
64013         LDKRoute this_ptr_conv;
64014         this_ptr_conv.inner = untag_ptr(this_ptr);
64015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64017         this_ptr_conv.is_owned = false;
64018         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
64019         int64_tArray ret_arr = NULL;
64020         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64021         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64022         for (size_t g = 0; g < ret_var.datalen; g++) {
64023                 LDKPath ret_conv_6_var = ret_var.data[g];
64024                 int64_t ret_conv_6_ref = 0;
64025                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
64026                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
64027                 ret_arr_ptr[g] = ret_conv_6_ref;
64028         }
64029         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64030         FREE(ret_var.data);
64031         return ret_arr;
64032 }
64033
64034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64035         LDKRoute this_ptr_conv;
64036         this_ptr_conv.inner = untag_ptr(this_ptr);
64037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64039         this_ptr_conv.is_owned = false;
64040         LDKCVec_PathZ val_constr;
64041         val_constr.datalen = (*env)->GetArrayLength(env, val);
64042         if (val_constr.datalen > 0)
64043                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64044         else
64045                 val_constr.data = NULL;
64046         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64047         for (size_t g = 0; g < val_constr.datalen; g++) {
64048                 int64_t val_conv_6 = val_vals[g];
64049                 LDKPath val_conv_6_conv;
64050                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
64051                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
64052                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
64053                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
64054                 val_constr.data[g] = val_conv_6_conv;
64055         }
64056         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64057         Route_set_paths(&this_ptr_conv, val_constr);
64058 }
64059
64060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
64061         LDKRoute this_ptr_conv;
64062         this_ptr_conv.inner = untag_ptr(this_ptr);
64063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64065         this_ptr_conv.is_owned = false;
64066         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
64067         int64_t ret_ref = 0;
64068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64070         return ret_ref;
64071 }
64072
64073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64074         LDKRoute this_ptr_conv;
64075         this_ptr_conv.inner = untag_ptr(this_ptr);
64076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64078         this_ptr_conv.is_owned = false;
64079         LDKRouteParameters val_conv;
64080         val_conv.inner = untag_ptr(val);
64081         val_conv.is_owned = ptr_is_owned(val);
64082         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64083         val_conv = RouteParameters_clone(&val_conv);
64084         Route_set_route_params(&this_ptr_conv, val_conv);
64085 }
64086
64087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t route_params_arg) {
64088         LDKCVec_PathZ paths_arg_constr;
64089         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
64090         if (paths_arg_constr.datalen > 0)
64091                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64092         else
64093                 paths_arg_constr.data = NULL;
64094         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
64095         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
64096                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
64097                 LDKPath paths_arg_conv_6_conv;
64098                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
64099                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
64100                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
64101                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
64102                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
64103         }
64104         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
64105         LDKRouteParameters route_params_arg_conv;
64106         route_params_arg_conv.inner = untag_ptr(route_params_arg);
64107         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
64108         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
64109         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
64110         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
64111         int64_t ret_ref = 0;
64112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64114         return ret_ref;
64115 }
64116
64117 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
64118         LDKRoute ret_var = Route_clone(arg);
64119         int64_t ret_ref = 0;
64120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64122         return ret_ref;
64123 }
64124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64125         LDKRoute arg_conv;
64126         arg_conv.inner = untag_ptr(arg);
64127         arg_conv.is_owned = ptr_is_owned(arg);
64128         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64129         arg_conv.is_owned = false;
64130         int64_t ret_conv = Route_clone_ptr(&arg_conv);
64131         return ret_conv;
64132 }
64133
64134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64135         LDKRoute orig_conv;
64136         orig_conv.inner = untag_ptr(orig);
64137         orig_conv.is_owned = ptr_is_owned(orig);
64138         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64139         orig_conv.is_owned = false;
64140         LDKRoute ret_var = Route_clone(&orig_conv);
64141         int64_t ret_ref = 0;
64142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64144         return ret_ref;
64145 }
64146
64147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
64148         LDKRoute o_conv;
64149         o_conv.inner = untag_ptr(o);
64150         o_conv.is_owned = ptr_is_owned(o);
64151         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64152         o_conv.is_owned = false;
64153         int64_t ret_conv = Route_hash(&o_conv);
64154         return ret_conv;
64155 }
64156
64157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64158         LDKRoute a_conv;
64159         a_conv.inner = untag_ptr(a);
64160         a_conv.is_owned = ptr_is_owned(a);
64161         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64162         a_conv.is_owned = false;
64163         LDKRoute b_conv;
64164         b_conv.inner = untag_ptr(b);
64165         b_conv.is_owned = ptr_is_owned(b);
64166         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64167         b_conv.is_owned = false;
64168         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
64169         return ret_conv;
64170 }
64171
64172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
64173         LDKRoute this_arg_conv;
64174         this_arg_conv.inner = untag_ptr(this_arg);
64175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64177         this_arg_conv.is_owned = false;
64178         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
64179         return ret_conv;
64180 }
64181
64182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
64183         LDKRoute this_arg_conv;
64184         this_arg_conv.inner = untag_ptr(this_arg);
64185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64187         this_arg_conv.is_owned = false;
64188         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
64189         return ret_conv;
64190 }
64191
64192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
64193         LDKRoute obj_conv;
64194         obj_conv.inner = untag_ptr(obj);
64195         obj_conv.is_owned = ptr_is_owned(obj);
64196         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64197         obj_conv.is_owned = false;
64198         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
64199         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64200         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64201         CVec_u8Z_free(ret_var);
64202         return ret_arr;
64203 }
64204
64205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64206         LDKu8slice ser_ref;
64207         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64208         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64209         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
64210         *ret_conv = Route_read(ser_ref);
64211         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64212         return tag_ptr(ret_conv, true);
64213 }
64214
64215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64216         LDKRouteParameters this_obj_conv;
64217         this_obj_conv.inner = untag_ptr(this_obj);
64218         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64220         RouteParameters_free(this_obj_conv);
64221 }
64222
64223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
64224         LDKRouteParameters this_ptr_conv;
64225         this_ptr_conv.inner = untag_ptr(this_ptr);
64226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64228         this_ptr_conv.is_owned = false;
64229         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
64230         int64_t ret_ref = 0;
64231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64233         return ret_ref;
64234 }
64235
64236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64237         LDKRouteParameters this_ptr_conv;
64238         this_ptr_conv.inner = untag_ptr(this_ptr);
64239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64241         this_ptr_conv.is_owned = false;
64242         LDKPaymentParameters val_conv;
64243         val_conv.inner = untag_ptr(val);
64244         val_conv.is_owned = ptr_is_owned(val);
64245         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64246         val_conv = PaymentParameters_clone(&val_conv);
64247         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
64248 }
64249
64250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64251         LDKRouteParameters this_ptr_conv;
64252         this_ptr_conv.inner = untag_ptr(this_ptr);
64253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64255         this_ptr_conv.is_owned = false;
64256         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
64257         return ret_conv;
64258 }
64259
64260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64261         LDKRouteParameters this_ptr_conv;
64262         this_ptr_conv.inner = untag_ptr(this_ptr);
64263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64265         this_ptr_conv.is_owned = false;
64266         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
64267 }
64268
64269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64270         LDKRouteParameters this_ptr_conv;
64271         this_ptr_conv.inner = untag_ptr(this_ptr);
64272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64274         this_ptr_conv.is_owned = false;
64275         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64276         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
64277         int64_t ret_ref = tag_ptr(ret_copy, true);
64278         return ret_ref;
64279 }
64280
64281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64282         LDKRouteParameters this_ptr_conv;
64283         this_ptr_conv.inner = untag_ptr(this_ptr);
64284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64286         this_ptr_conv.is_owned = false;
64287         void* val_ptr = untag_ptr(val);
64288         CHECK_ACCESS(val_ptr);
64289         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
64290         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
64291         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
64292 }
64293
64294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payment_params_arg, int64_t final_value_msat_arg, int64_t max_total_routing_fee_msat_arg) {
64295         LDKPaymentParameters payment_params_arg_conv;
64296         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
64297         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
64298         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
64299         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
64300         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
64301         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
64302         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
64303         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
64304         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
64305         int64_t ret_ref = 0;
64306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64308         return ret_ref;
64309 }
64310
64311 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
64312         LDKRouteParameters ret_var = RouteParameters_clone(arg);
64313         int64_t ret_ref = 0;
64314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64316         return ret_ref;
64317 }
64318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64319         LDKRouteParameters arg_conv;
64320         arg_conv.inner = untag_ptr(arg);
64321         arg_conv.is_owned = ptr_is_owned(arg);
64322         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64323         arg_conv.is_owned = false;
64324         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
64325         return ret_conv;
64326 }
64327
64328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64329         LDKRouteParameters orig_conv;
64330         orig_conv.inner = untag_ptr(orig);
64331         orig_conv.is_owned = ptr_is_owned(orig);
64332         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64333         orig_conv.is_owned = false;
64334         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
64335         int64_t ret_ref = 0;
64336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64338         return ret_ref;
64339 }
64340
64341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
64342         LDKRouteParameters o_conv;
64343         o_conv.inner = untag_ptr(o);
64344         o_conv.is_owned = ptr_is_owned(o);
64345         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64346         o_conv.is_owned = false;
64347         int64_t ret_conv = RouteParameters_hash(&o_conv);
64348         return ret_conv;
64349 }
64350
64351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64352         LDKRouteParameters a_conv;
64353         a_conv.inner = untag_ptr(a);
64354         a_conv.is_owned = ptr_is_owned(a);
64355         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64356         a_conv.is_owned = false;
64357         LDKRouteParameters b_conv;
64358         b_conv.inner = untag_ptr(b);
64359         b_conv.is_owned = ptr_is_owned(b);
64360         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64361         b_conv.is_owned = false;
64362         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
64363         return ret_conv;
64364 }
64365
64366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1from_1payment_1params_1and_1value(JNIEnv *env, jclass clz, int64_t payment_params, int64_t final_value_msat) {
64367         LDKPaymentParameters payment_params_conv;
64368         payment_params_conv.inner = untag_ptr(payment_params);
64369         payment_params_conv.is_owned = ptr_is_owned(payment_params);
64370         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
64371         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
64372         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
64373         int64_t ret_ref = 0;
64374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64376         return ret_ref;
64377 }
64378
64379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
64380         LDKRouteParameters obj_conv;
64381         obj_conv.inner = untag_ptr(obj);
64382         obj_conv.is_owned = ptr_is_owned(obj);
64383         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64384         obj_conv.is_owned = false;
64385         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
64386         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64387         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64388         CVec_u8Z_free(ret_var);
64389         return ret_arr;
64390 }
64391
64392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64393         LDKu8slice ser_ref;
64394         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64395         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64396         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
64397         *ret_conv = RouteParameters_read(ser_ref);
64398         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64399         return tag_ptr(ret_conv, true);
64400 }
64401
64402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64403         LDKPaymentParameters this_obj_conv;
64404         this_obj_conv.inner = untag_ptr(this_obj);
64405         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64407         PaymentParameters_free(this_obj_conv);
64408 }
64409
64410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
64411         LDKPaymentParameters this_ptr_conv;
64412         this_ptr_conv.inner = untag_ptr(this_ptr);
64413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64415         this_ptr_conv.is_owned = false;
64416         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64417         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
64418         int64_t ret_ref = tag_ptr(ret_copy, true);
64419         return ret_ref;
64420 }
64421
64422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64423         LDKPaymentParameters this_ptr_conv;
64424         this_ptr_conv.inner = untag_ptr(this_ptr);
64425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64427         this_ptr_conv.is_owned = false;
64428         void* val_ptr = untag_ptr(val);
64429         CHECK_ACCESS(val_ptr);
64430         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
64431         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
64432         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
64433 }
64434
64435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
64436         LDKPaymentParameters this_ptr_conv;
64437         this_ptr_conv.inner = untag_ptr(this_ptr);
64438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64440         this_ptr_conv.is_owned = false;
64441         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64442         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
64443         int64_t ret_ref = tag_ptr(ret_copy, true);
64444         return ret_ref;
64445 }
64446
64447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64448         LDKPaymentParameters this_ptr_conv;
64449         this_ptr_conv.inner = untag_ptr(this_ptr);
64450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64452         this_ptr_conv.is_owned = false;
64453         void* val_ptr = untag_ptr(val);
64454         CHECK_ACCESS(val_ptr);
64455         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
64456         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
64457         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
64458 }
64459
64460 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
64461         LDKPaymentParameters this_ptr_conv;
64462         this_ptr_conv.inner = untag_ptr(this_ptr);
64463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64465         this_ptr_conv.is_owned = false;
64466         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
64467         return ret_conv;
64468 }
64469
64470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
64471         LDKPaymentParameters this_ptr_conv;
64472         this_ptr_conv.inner = untag_ptr(this_ptr);
64473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64475         this_ptr_conv.is_owned = false;
64476         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
64477 }
64478
64479 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
64480         LDKPaymentParameters this_ptr_conv;
64481         this_ptr_conv.inner = untag_ptr(this_ptr);
64482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64484         this_ptr_conv.is_owned = false;
64485         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
64486         return ret_conv;
64487 }
64488
64489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
64490         LDKPaymentParameters this_ptr_conv;
64491         this_ptr_conv.inner = untag_ptr(this_ptr);
64492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64494         this_ptr_conv.is_owned = false;
64495         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
64496 }
64497
64498 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr) {
64499         LDKPaymentParameters this_ptr_conv;
64500         this_ptr_conv.inner = untag_ptr(this_ptr);
64501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64503         this_ptr_conv.is_owned = false;
64504         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
64505         return ret_conv;
64506 }
64507
64508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
64509         LDKPaymentParameters this_ptr_conv;
64510         this_ptr_conv.inner = untag_ptr(this_ptr);
64511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64513         this_ptr_conv.is_owned = false;
64514         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
64515 }
64516
64517 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
64518         LDKPaymentParameters this_ptr_conv;
64519         this_ptr_conv.inner = untag_ptr(this_ptr);
64520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64522         this_ptr_conv.is_owned = false;
64523         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
64524         int64_tArray ret_arr = NULL;
64525         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64526         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64527         for (size_t g = 0; g < ret_var.datalen; g++) {
64528                 int64_t ret_conv_6_conv = ret_var.data[g];
64529                 ret_arr_ptr[g] = ret_conv_6_conv;
64530         }
64531         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64532         FREE(ret_var.data);
64533         return ret_arr;
64534 }
64535
64536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64537         LDKPaymentParameters this_ptr_conv;
64538         this_ptr_conv.inner = untag_ptr(this_ptr);
64539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64541         this_ptr_conv.is_owned = false;
64542         LDKCVec_u64Z val_constr;
64543         val_constr.datalen = (*env)->GetArrayLength(env, val);
64544         if (val_constr.datalen > 0)
64545                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
64546         else
64547                 val_constr.data = NULL;
64548         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64549         for (size_t g = 0; g < val_constr.datalen; g++) {
64550                 int64_t val_conv_6 = val_vals[g];
64551                 val_constr.data[g] = val_conv_6;
64552         }
64553         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64554         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
64555 }
64556
64557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int64_t payee_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg) {
64558         void* payee_arg_ptr = untag_ptr(payee_arg);
64559         CHECK_ACCESS(payee_arg_ptr);
64560         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
64561         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
64562         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
64563         CHECK_ACCESS(expiry_time_arg_ptr);
64564         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
64565         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
64566         LDKCVec_u64Z previously_failed_channels_arg_constr;
64567         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
64568         if (previously_failed_channels_arg_constr.datalen > 0)
64569                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
64570         else
64571                 previously_failed_channels_arg_constr.data = NULL;
64572         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
64573         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
64574                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
64575                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
64576         }
64577         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
64578         LDKPaymentParameters ret_var = PaymentParameters_new(payee_arg_conv, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr);
64579         int64_t ret_ref = 0;
64580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64582         return ret_ref;
64583 }
64584
64585 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
64586         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
64587         int64_t ret_ref = 0;
64588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64590         return ret_ref;
64591 }
64592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64593         LDKPaymentParameters arg_conv;
64594         arg_conv.inner = untag_ptr(arg);
64595         arg_conv.is_owned = ptr_is_owned(arg);
64596         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64597         arg_conv.is_owned = false;
64598         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
64599         return ret_conv;
64600 }
64601
64602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64603         LDKPaymentParameters orig_conv;
64604         orig_conv.inner = untag_ptr(orig);
64605         orig_conv.is_owned = ptr_is_owned(orig);
64606         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64607         orig_conv.is_owned = false;
64608         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
64609         int64_t ret_ref = 0;
64610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64612         return ret_ref;
64613 }
64614
64615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
64616         LDKPaymentParameters o_conv;
64617         o_conv.inner = untag_ptr(o);
64618         o_conv.is_owned = ptr_is_owned(o);
64619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64620         o_conv.is_owned = false;
64621         int64_t ret_conv = PaymentParameters_hash(&o_conv);
64622         return ret_conv;
64623 }
64624
64625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64626         LDKPaymentParameters a_conv;
64627         a_conv.inner = untag_ptr(a);
64628         a_conv.is_owned = ptr_is_owned(a);
64629         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64630         a_conv.is_owned = false;
64631         LDKPaymentParameters b_conv;
64632         b_conv.inner = untag_ptr(b);
64633         b_conv.is_owned = ptr_is_owned(b);
64634         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64635         b_conv.is_owned = false;
64636         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
64637         return ret_conv;
64638 }
64639
64640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
64641         LDKPaymentParameters obj_conv;
64642         obj_conv.inner = untag_ptr(obj);
64643         obj_conv.is_owned = ptr_is_owned(obj);
64644         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64645         obj_conv.is_owned = false;
64646         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
64647         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64648         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64649         CVec_u8Z_free(ret_var);
64650         return ret_arr;
64651 }
64652
64653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
64654         LDKu8slice ser_ref;
64655         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64656         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64657         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
64658         *ret_conv = PaymentParameters_read(ser_ref, arg);
64659         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64660         return tag_ptr(ret_conv, true);
64661 }
64662
64663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
64664         LDKPublicKey payee_pubkey_ref;
64665         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
64666         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
64667         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
64668         int64_t ret_ref = 0;
64669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64671         return ret_ref;
64672 }
64673
64674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta, jboolean allow_mpp) {
64675         LDKPublicKey payee_pubkey_ref;
64676         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
64677         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
64678         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
64679         int64_t ret_ref = 0;
64680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64682         return ret_ref;
64683 }
64684
64685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
64686         LDKBolt12Invoice invoice_conv;
64687         invoice_conv.inner = untag_ptr(invoice);
64688         invoice_conv.is_owned = ptr_is_owned(invoice);
64689         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
64690         invoice_conv.is_owned = false;
64691         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
64692         int64_t ret_ref = 0;
64693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64695         return ret_ref;
64696 }
64697
64698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1blinded(JNIEnv *env, jclass clz, int64_tArray blinded_route_hints) {
64699         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
64700         blinded_route_hints_constr.datalen = (*env)->GetArrayLength(env, blinded_route_hints);
64701         if (blinded_route_hints_constr.datalen > 0)
64702                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
64703         else
64704                 blinded_route_hints_constr.data = NULL;
64705         int64_t* blinded_route_hints_vals = (*env)->GetLongArrayElements (env, blinded_route_hints, NULL);
64706         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
64707                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
64708                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
64709                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
64710                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
64711                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
64712                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
64713         }
64714         (*env)->ReleaseLongArrayElements(env, blinded_route_hints, blinded_route_hints_vals, 0);
64715         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
64716         int64_t ret_ref = 0;
64717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64719         return ret_ref;
64720 }
64721
64722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64723         if (!ptr_is_owned(this_ptr)) return;
64724         void* this_ptr_ptr = untag_ptr(this_ptr);
64725         CHECK_ACCESS(this_ptr_ptr);
64726         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
64727         FREE(untag_ptr(this_ptr));
64728         Payee_free(this_ptr_conv);
64729 }
64730
64731 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
64732         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64733         *ret_copy = Payee_clone(arg);
64734         int64_t ret_ref = tag_ptr(ret_copy, true);
64735         return ret_ref;
64736 }
64737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64738         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
64739         int64_t ret_conv = Payee_clone_ptr(arg_conv);
64740         return ret_conv;
64741 }
64742
64743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64744         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
64745         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64746         *ret_copy = Payee_clone(orig_conv);
64747         int64_t ret_ref = tag_ptr(ret_copy, true);
64748         return ret_ref;
64749 }
64750
64751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
64752         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
64753         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
64754         if (route_hints_constr.datalen > 0)
64755                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
64756         else
64757                 route_hints_constr.data = NULL;
64758         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
64759         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
64760                 int64_t route_hints_conv_37 = route_hints_vals[l];
64761                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
64762                 CHECK_ACCESS(route_hints_conv_37_ptr);
64763                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
64764                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
64765                 route_hints_constr.data[l] = route_hints_conv_37_conv;
64766         }
64767         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
64768         LDKBolt12InvoiceFeatures features_conv;
64769         features_conv.inner = untag_ptr(features);
64770         features_conv.is_owned = ptr_is_owned(features);
64771         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
64772         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
64773         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64774         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
64775         int64_t ret_ref = tag_ptr(ret_copy, true);
64776         return ret_ref;
64777 }
64778
64779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clear(JNIEnv *env, jclass clz, int8_tArray node_id, int64_tArray route_hints, int64_t features, int32_t final_cltv_expiry_delta) {
64780         LDKPublicKey node_id_ref;
64781         CHECK((*env)->GetArrayLength(env, node_id) == 33);
64782         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
64783         LDKCVec_RouteHintZ route_hints_constr;
64784         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
64785         if (route_hints_constr.datalen > 0)
64786                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
64787         else
64788                 route_hints_constr.data = NULL;
64789         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
64790         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
64791                 int64_t route_hints_conv_11 = route_hints_vals[l];
64792                 LDKRouteHint route_hints_conv_11_conv;
64793                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
64794                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
64795                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
64796                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
64797                 route_hints_constr.data[l] = route_hints_conv_11_conv;
64798         }
64799         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
64800         LDKBolt11InvoiceFeatures features_conv;
64801         features_conv.inner = untag_ptr(features);
64802         features_conv.is_owned = ptr_is_owned(features);
64803         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
64804         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
64805         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
64806         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
64807         int64_t ret_ref = tag_ptr(ret_copy, true);
64808         return ret_ref;
64809 }
64810
64811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
64812         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
64813         int64_t ret_conv = Payee_hash(o_conv);
64814         return ret_conv;
64815 }
64816
64817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64818         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
64819         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
64820         jboolean ret_conv = Payee_eq(a_conv, b_conv);
64821         return ret_conv;
64822 }
64823
64824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64825         LDKRouteHint this_obj_conv;
64826         this_obj_conv.inner = untag_ptr(this_obj);
64827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64829         RouteHint_free(this_obj_conv);
64830 }
64831
64832 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
64833         LDKRouteHint this_ptr_conv;
64834         this_ptr_conv.inner = untag_ptr(this_ptr);
64835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64837         this_ptr_conv.is_owned = false;
64838         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
64839         int64_tArray ret_arr = NULL;
64840         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64841         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64842         for (size_t o = 0; o < ret_var.datalen; o++) {
64843                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
64844                 int64_t ret_conv_14_ref = 0;
64845                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
64846                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
64847                 ret_arr_ptr[o] = ret_conv_14_ref;
64848         }
64849         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64850         FREE(ret_var.data);
64851         return ret_arr;
64852 }
64853
64854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64855         LDKRouteHint this_ptr_conv;
64856         this_ptr_conv.inner = untag_ptr(this_ptr);
64857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64859         this_ptr_conv.is_owned = false;
64860         LDKCVec_RouteHintHopZ val_constr;
64861         val_constr.datalen = (*env)->GetArrayLength(env, val);
64862         if (val_constr.datalen > 0)
64863                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
64864         else
64865                 val_constr.data = NULL;
64866         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64867         for (size_t o = 0; o < val_constr.datalen; o++) {
64868                 int64_t val_conv_14 = val_vals[o];
64869                 LDKRouteHintHop val_conv_14_conv;
64870                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
64871                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
64872                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
64873                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
64874                 val_constr.data[o] = val_conv_14_conv;
64875         }
64876         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64877         RouteHint_set_a(&this_ptr_conv, val_constr);
64878 }
64879
64880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
64881         LDKCVec_RouteHintHopZ a_arg_constr;
64882         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
64883         if (a_arg_constr.datalen > 0)
64884                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
64885         else
64886                 a_arg_constr.data = NULL;
64887         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
64888         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
64889                 int64_t a_arg_conv_14 = a_arg_vals[o];
64890                 LDKRouteHintHop a_arg_conv_14_conv;
64891                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
64892                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
64893                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
64894                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
64895                 a_arg_constr.data[o] = a_arg_conv_14_conv;
64896         }
64897         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
64898         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
64899         int64_t ret_ref = 0;
64900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64902         return ret_ref;
64903 }
64904
64905 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
64906         LDKRouteHint ret_var = RouteHint_clone(arg);
64907         int64_t ret_ref = 0;
64908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64910         return ret_ref;
64911 }
64912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64913         LDKRouteHint arg_conv;
64914         arg_conv.inner = untag_ptr(arg);
64915         arg_conv.is_owned = ptr_is_owned(arg);
64916         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64917         arg_conv.is_owned = false;
64918         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
64919         return ret_conv;
64920 }
64921
64922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64923         LDKRouteHint orig_conv;
64924         orig_conv.inner = untag_ptr(orig);
64925         orig_conv.is_owned = ptr_is_owned(orig);
64926         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64927         orig_conv.is_owned = false;
64928         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
64929         int64_t ret_ref = 0;
64930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64932         return ret_ref;
64933 }
64934
64935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
64936         LDKRouteHint o_conv;
64937         o_conv.inner = untag_ptr(o);
64938         o_conv.is_owned = ptr_is_owned(o);
64939         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64940         o_conv.is_owned = false;
64941         int64_t ret_conv = RouteHint_hash(&o_conv);
64942         return ret_conv;
64943 }
64944
64945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64946         LDKRouteHint a_conv;
64947         a_conv.inner = untag_ptr(a);
64948         a_conv.is_owned = ptr_is_owned(a);
64949         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64950         a_conv.is_owned = false;
64951         LDKRouteHint b_conv;
64952         b_conv.inner = untag_ptr(b);
64953         b_conv.is_owned = ptr_is_owned(b);
64954         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64955         b_conv.is_owned = false;
64956         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
64957         return ret_conv;
64958 }
64959
64960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
64961         LDKRouteHint obj_conv;
64962         obj_conv.inner = untag_ptr(obj);
64963         obj_conv.is_owned = ptr_is_owned(obj);
64964         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64965         obj_conv.is_owned = false;
64966         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
64967         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64968         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64969         CVec_u8Z_free(ret_var);
64970         return ret_arr;
64971 }
64972
64973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64974         LDKu8slice ser_ref;
64975         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64976         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64977         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
64978         *ret_conv = RouteHint_read(ser_ref);
64979         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64980         return tag_ptr(ret_conv, true);
64981 }
64982
64983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64984         LDKRouteHintHop this_obj_conv;
64985         this_obj_conv.inner = untag_ptr(this_obj);
64986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64988         RouteHintHop_free(this_obj_conv);
64989 }
64990
64991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
64992         LDKRouteHintHop this_ptr_conv;
64993         this_ptr_conv.inner = untag_ptr(this_ptr);
64994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64996         this_ptr_conv.is_owned = false;
64997         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64998         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
64999         return ret_arr;
65000 }
65001
65002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
65003         LDKRouteHintHop this_ptr_conv;
65004         this_ptr_conv.inner = untag_ptr(this_ptr);
65005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65007         this_ptr_conv.is_owned = false;
65008         LDKPublicKey val_ref;
65009         CHECK((*env)->GetArrayLength(env, val) == 33);
65010         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
65011         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
65012 }
65013
65014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
65015         LDKRouteHintHop this_ptr_conv;
65016         this_ptr_conv.inner = untag_ptr(this_ptr);
65017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65019         this_ptr_conv.is_owned = false;
65020         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
65021         return ret_conv;
65022 }
65023
65024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65025         LDKRouteHintHop this_ptr_conv;
65026         this_ptr_conv.inner = untag_ptr(this_ptr);
65027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65029         this_ptr_conv.is_owned = false;
65030         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
65031 }
65032
65033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
65034         LDKRouteHintHop this_ptr_conv;
65035         this_ptr_conv.inner = untag_ptr(this_ptr);
65036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65038         this_ptr_conv.is_owned = false;
65039         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
65040         int64_t ret_ref = 0;
65041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65043         return ret_ref;
65044 }
65045
65046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65047         LDKRouteHintHop this_ptr_conv;
65048         this_ptr_conv.inner = untag_ptr(this_ptr);
65049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65051         this_ptr_conv.is_owned = false;
65052         LDKRoutingFees val_conv;
65053         val_conv.inner = untag_ptr(val);
65054         val_conv.is_owned = ptr_is_owned(val);
65055         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65056         val_conv = RoutingFees_clone(&val_conv);
65057         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
65058 }
65059
65060 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
65061         LDKRouteHintHop this_ptr_conv;
65062         this_ptr_conv.inner = untag_ptr(this_ptr);
65063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65065         this_ptr_conv.is_owned = false;
65066         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
65067         return ret_conv;
65068 }
65069
65070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
65071         LDKRouteHintHop this_ptr_conv;
65072         this_ptr_conv.inner = untag_ptr(this_ptr);
65073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65075         this_ptr_conv.is_owned = false;
65076         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
65077 }
65078
65079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65080         LDKRouteHintHop this_ptr_conv;
65081         this_ptr_conv.inner = untag_ptr(this_ptr);
65082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65084         this_ptr_conv.is_owned = false;
65085         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65086         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
65087         int64_t ret_ref = tag_ptr(ret_copy, true);
65088         return ret_ref;
65089 }
65090
65091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65092         LDKRouteHintHop this_ptr_conv;
65093         this_ptr_conv.inner = untag_ptr(this_ptr);
65094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65096         this_ptr_conv.is_owned = false;
65097         void* val_ptr = untag_ptr(val);
65098         CHECK_ACCESS(val_ptr);
65099         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65100         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65101         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
65102 }
65103
65104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65105         LDKRouteHintHop this_ptr_conv;
65106         this_ptr_conv.inner = untag_ptr(this_ptr);
65107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65109         this_ptr_conv.is_owned = false;
65110         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65111         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
65112         int64_t ret_ref = tag_ptr(ret_copy, true);
65113         return ret_ref;
65114 }
65115
65116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65117         LDKRouteHintHop this_ptr_conv;
65118         this_ptr_conv.inner = untag_ptr(this_ptr);
65119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65121         this_ptr_conv.is_owned = false;
65122         void* val_ptr = untag_ptr(val);
65123         CHECK_ACCESS(val_ptr);
65124         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65125         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65126         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
65127 }
65128
65129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) {
65130         LDKPublicKey src_node_id_arg_ref;
65131         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
65132         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
65133         LDKRoutingFees fees_arg_conv;
65134         fees_arg_conv.inner = untag_ptr(fees_arg);
65135         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
65136         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
65137         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
65138         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
65139         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
65140         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
65141         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
65142         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
65143         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
65144         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
65145         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
65146         LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
65147         int64_t ret_ref = 0;
65148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65150         return ret_ref;
65151 }
65152
65153 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
65154         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
65155         int64_t ret_ref = 0;
65156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65158         return ret_ref;
65159 }
65160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65161         LDKRouteHintHop arg_conv;
65162         arg_conv.inner = untag_ptr(arg);
65163         arg_conv.is_owned = ptr_is_owned(arg);
65164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65165         arg_conv.is_owned = false;
65166         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
65167         return ret_conv;
65168 }
65169
65170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65171         LDKRouteHintHop orig_conv;
65172         orig_conv.inner = untag_ptr(orig);
65173         orig_conv.is_owned = ptr_is_owned(orig);
65174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65175         orig_conv.is_owned = false;
65176         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
65177         int64_t ret_ref = 0;
65178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65180         return ret_ref;
65181 }
65182
65183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
65184         LDKRouteHintHop o_conv;
65185         o_conv.inner = untag_ptr(o);
65186         o_conv.is_owned = ptr_is_owned(o);
65187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65188         o_conv.is_owned = false;
65189         int64_t ret_conv = RouteHintHop_hash(&o_conv);
65190         return ret_conv;
65191 }
65192
65193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65194         LDKRouteHintHop a_conv;
65195         a_conv.inner = untag_ptr(a);
65196         a_conv.is_owned = ptr_is_owned(a);
65197         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65198         a_conv.is_owned = false;
65199         LDKRouteHintHop b_conv;
65200         b_conv.inner = untag_ptr(b);
65201         b_conv.is_owned = ptr_is_owned(b);
65202         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65203         b_conv.is_owned = false;
65204         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
65205         return ret_conv;
65206 }
65207
65208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
65209         LDKRouteHintHop obj_conv;
65210         obj_conv.inner = untag_ptr(obj);
65211         obj_conv.is_owned = ptr_is_owned(obj);
65212         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65213         obj_conv.is_owned = false;
65214         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
65215         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65216         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65217         CVec_u8Z_free(ret_var);
65218         return ret_arr;
65219 }
65220
65221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65222         LDKu8slice ser_ref;
65223         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65224         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65225         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
65226         *ret_conv = RouteHintHop_read(ser_ref);
65227         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65228         return tag_ptr(ret_conv, true);
65229 }
65230
65231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network_graph, int64_tArray first_hops, int64_t logger, int64_t scorer, int64_t score_params, int8_tArray random_seed_bytes) {
65232         LDKPublicKey our_node_pubkey_ref;
65233         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
65234         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
65235         LDKRouteParameters route_params_conv;
65236         route_params_conv.inner = untag_ptr(route_params);
65237         route_params_conv.is_owned = ptr_is_owned(route_params);
65238         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
65239         route_params_conv.is_owned = false;
65240         LDKNetworkGraph network_graph_conv;
65241         network_graph_conv.inner = untag_ptr(network_graph);
65242         network_graph_conv.is_owned = ptr_is_owned(network_graph);
65243         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
65244         network_graph_conv.is_owned = false;
65245         LDKCVec_ChannelDetailsZ first_hops_constr;
65246         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
65247         if (first_hops != NULL) {
65248                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
65249                 if (first_hops_constr.datalen > 0)
65250                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
65251                 else
65252                         first_hops_constr.data = NULL;
65253                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
65254                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
65255                         int64_t first_hops_conv_16 = first_hops_vals[q];
65256                         LDKChannelDetails first_hops_conv_16_conv;
65257                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
65258                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
65259                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
65260                         first_hops_conv_16_conv.is_owned = false;
65261                         first_hops_constr.data[q] = first_hops_conv_16_conv;
65262                 }
65263                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
65264                 first_hops_ptr = &first_hops_constr;
65265         }
65266         void* logger_ptr = untag_ptr(logger);
65267         CHECK_ACCESS(logger_ptr);
65268         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
65269         if (logger_conv.free == LDKLogger_JCalls_free) {
65270                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65271                 LDKLogger_JCalls_cloned(&logger_conv);
65272         }
65273         void* scorer_ptr = untag_ptr(scorer);
65274         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
65275         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
65276         LDKProbabilisticScoringFeeParameters score_params_conv;
65277         score_params_conv.inner = untag_ptr(score_params);
65278         score_params_conv.is_owned = ptr_is_owned(score_params);
65279         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
65280         score_params_conv.is_owned = false;
65281         uint8_t random_seed_bytes_arr[32];
65282         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
65283         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
65284         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
65285         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
65286         *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, &score_params_conv, random_seed_bytes_ref);
65287         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
65288         return tag_ptr(ret_conv, true);
65289 }
65290
65291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_build_1route_1from_1hops(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, jobjectArray hops, int64_t route_params, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) {
65292         LDKPublicKey our_node_pubkey_ref;
65293         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
65294         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
65295         LDKCVec_PublicKeyZ hops_constr;
65296         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
65297         if (hops_constr.datalen > 0)
65298                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
65299         else
65300                 hops_constr.data = NULL;
65301         for (size_t i = 0; i < hops_constr.datalen; i++) {
65302                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
65303                 LDKPublicKey hops_conv_8_ref;
65304                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
65305                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
65306                 hops_constr.data[i] = hops_conv_8_ref;
65307         }
65308         LDKRouteParameters route_params_conv;
65309         route_params_conv.inner = untag_ptr(route_params);
65310         route_params_conv.is_owned = ptr_is_owned(route_params);
65311         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
65312         route_params_conv.is_owned = false;
65313         LDKNetworkGraph network_graph_conv;
65314         network_graph_conv.inner = untag_ptr(network_graph);
65315         network_graph_conv.is_owned = ptr_is_owned(network_graph);
65316         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
65317         network_graph_conv.is_owned = false;
65318         void* logger_ptr = untag_ptr(logger);
65319         CHECK_ACCESS(logger_ptr);
65320         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
65321         if (logger_conv.free == LDKLogger_JCalls_free) {
65322                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65323                 LDKLogger_JCalls_cloned(&logger_conv);
65324         }
65325         uint8_t random_seed_bytes_arr[32];
65326         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
65327         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
65328         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
65329         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
65330         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
65331         return tag_ptr(ret_conv, true);
65332 }
65333
65334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65335         if (!ptr_is_owned(this_ptr)) return;
65336         void* this_ptr_ptr = untag_ptr(this_ptr);
65337         CHECK_ACCESS(this_ptr_ptr);
65338         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
65339         FREE(untag_ptr(this_ptr));
65340         ScoreLookUp_free(this_ptr_conv);
65341 }
65342
65343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65344         if (!ptr_is_owned(this_ptr)) return;
65345         void* this_ptr_ptr = untag_ptr(this_ptr);
65346         CHECK_ACCESS(this_ptr_ptr);
65347         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
65348         FREE(untag_ptr(this_ptr));
65349         ScoreUpdate_free(this_ptr_conv);
65350 }
65351
65352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65353         if (!ptr_is_owned(this_ptr)) return;
65354         void* this_ptr_ptr = untag_ptr(this_ptr);
65355         CHECK_ACCESS(this_ptr_ptr);
65356         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
65357         FREE(untag_ptr(this_ptr));
65358         Score_free(this_ptr_conv);
65359 }
65360
65361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65362         if (!ptr_is_owned(this_ptr)) return;
65363         void* this_ptr_ptr = untag_ptr(this_ptr);
65364         CHECK_ACCESS(this_ptr_ptr);
65365         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
65366         FREE(untag_ptr(this_ptr));
65367         LockableScore_free(this_ptr_conv);
65368 }
65369
65370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65371         if (!ptr_is_owned(this_ptr)) return;
65372         void* this_ptr_ptr = untag_ptr(this_ptr);
65373         CHECK_ACCESS(this_ptr_ptr);
65374         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
65375         FREE(untag_ptr(this_ptr));
65376         WriteableScore_free(this_ptr_conv);
65377 }
65378
65379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65380         LDKMultiThreadedLockableScore this_obj_conv;
65381         this_obj_conv.inner = untag_ptr(this_obj);
65382         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65384         MultiThreadedLockableScore_free(this_obj_conv);
65385 }
65386
65387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
65388         LDKMultiThreadedLockableScore this_arg_conv;
65389         this_arg_conv.inner = untag_ptr(this_arg);
65390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65392         this_arg_conv.is_owned = false;
65393         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
65394         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
65395         return tag_ptr(ret_ret, true);
65396 }
65397
65398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
65399         LDKMultiThreadedLockableScore obj_conv;
65400         obj_conv.inner = untag_ptr(obj);
65401         obj_conv.is_owned = ptr_is_owned(obj);
65402         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65403         obj_conv.is_owned = false;
65404         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
65405         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65406         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65407         CVec_u8Z_free(ret_var);
65408         return ret_arr;
65409 }
65410
65411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
65412         LDKMultiThreadedLockableScore this_arg_conv;
65413         this_arg_conv.inner = untag_ptr(this_arg);
65414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65416         this_arg_conv.is_owned = false;
65417         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
65418         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
65419         return tag_ptr(ret_ret, true);
65420 }
65421
65422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
65423         void* score_ptr = untag_ptr(score);
65424         CHECK_ACCESS(score_ptr);
65425         LDKScore score_conv = *(LDKScore*)(score_ptr);
65426         if (score_conv.free == LDKScore_JCalls_free) {
65427                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65428                 LDKScore_JCalls_cloned(&score_conv);
65429         }
65430         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
65431         int64_t ret_ref = 0;
65432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65434         return ret_ref;
65435 }
65436
65437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65438         LDKMultiThreadedScoreLockRead this_obj_conv;
65439         this_obj_conv.inner = untag_ptr(this_obj);
65440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65442         MultiThreadedScoreLockRead_free(this_obj_conv);
65443 }
65444
65445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65446         LDKMultiThreadedScoreLockWrite this_obj_conv;
65447         this_obj_conv.inner = untag_ptr(this_obj);
65448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65450         MultiThreadedScoreLockWrite_free(this_obj_conv);
65451 }
65452
65453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
65454         LDKMultiThreadedScoreLockRead this_arg_conv;
65455         this_arg_conv.inner = untag_ptr(this_arg);
65456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65458         this_arg_conv.is_owned = false;
65459         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
65460         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
65461         return tag_ptr(ret_ret, true);
65462 }
65463
65464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1write(JNIEnv *env, jclass clz, int64_t obj) {
65465         LDKMultiThreadedScoreLockWrite obj_conv;
65466         obj_conv.inner = untag_ptr(obj);
65467         obj_conv.is_owned = ptr_is_owned(obj);
65468         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65469         obj_conv.is_owned = false;
65470         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
65471         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65472         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65473         CVec_u8Z_free(ret_var);
65474         return ret_arr;
65475 }
65476
65477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
65478         LDKMultiThreadedScoreLockWrite this_arg_conv;
65479         this_arg_conv.inner = untag_ptr(this_arg);
65480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65482         this_arg_conv.is_owned = false;
65483         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
65484         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
65485         return tag_ptr(ret_ret, true);
65486 }
65487
65488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65489         LDKChannelUsage this_obj_conv;
65490         this_obj_conv.inner = untag_ptr(this_obj);
65491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65493         ChannelUsage_free(this_obj_conv);
65494 }
65495
65496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65497         LDKChannelUsage this_ptr_conv;
65498         this_ptr_conv.inner = untag_ptr(this_ptr);
65499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65501         this_ptr_conv.is_owned = false;
65502         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
65503         return ret_conv;
65504 }
65505
65506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65507         LDKChannelUsage this_ptr_conv;
65508         this_ptr_conv.inner = untag_ptr(this_ptr);
65509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65511         this_ptr_conv.is_owned = false;
65512         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
65513 }
65514
65515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65516         LDKChannelUsage this_ptr_conv;
65517         this_ptr_conv.inner = untag_ptr(this_ptr);
65518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65520         this_ptr_conv.is_owned = false;
65521         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
65522         return ret_conv;
65523 }
65524
65525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65526         LDKChannelUsage this_ptr_conv;
65527         this_ptr_conv.inner = untag_ptr(this_ptr);
65528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65530         this_ptr_conv.is_owned = false;
65531         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
65532 }
65533
65534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
65535         LDKChannelUsage this_ptr_conv;
65536         this_ptr_conv.inner = untag_ptr(this_ptr);
65537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65539         this_ptr_conv.is_owned = false;
65540         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
65541         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
65542         int64_t ret_ref = tag_ptr(ret_copy, true);
65543         return ret_ref;
65544 }
65545
65546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65547         LDKChannelUsage this_ptr_conv;
65548         this_ptr_conv.inner = untag_ptr(this_ptr);
65549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65551         this_ptr_conv.is_owned = false;
65552         void* val_ptr = untag_ptr(val);
65553         CHECK_ACCESS(val_ptr);
65554         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
65555         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
65556         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
65557 }
65558
65559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1new(JNIEnv *env, jclass clz, int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, int64_t effective_capacity_arg) {
65560         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
65561         CHECK_ACCESS(effective_capacity_arg_ptr);
65562         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
65563         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
65564         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
65565         int64_t ret_ref = 0;
65566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65568         return ret_ref;
65569 }
65570
65571 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
65572         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
65573         int64_t ret_ref = 0;
65574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65576         return ret_ref;
65577 }
65578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65579         LDKChannelUsage arg_conv;
65580         arg_conv.inner = untag_ptr(arg);
65581         arg_conv.is_owned = ptr_is_owned(arg);
65582         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65583         arg_conv.is_owned = false;
65584         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
65585         return ret_conv;
65586 }
65587
65588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65589         LDKChannelUsage orig_conv;
65590         orig_conv.inner = untag_ptr(orig);
65591         orig_conv.is_owned = ptr_is_owned(orig);
65592         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65593         orig_conv.is_owned = false;
65594         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
65595         int64_t ret_ref = 0;
65596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65598         return ret_ref;
65599 }
65600
65601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65602         LDKFixedPenaltyScorer this_obj_conv;
65603         this_obj_conv.inner = untag_ptr(this_obj);
65604         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65606         FixedPenaltyScorer_free(this_obj_conv);
65607 }
65608
65609 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
65610         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
65611         int64_t ret_ref = 0;
65612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65614         return ret_ref;
65615 }
65616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65617         LDKFixedPenaltyScorer arg_conv;
65618         arg_conv.inner = untag_ptr(arg);
65619         arg_conv.is_owned = ptr_is_owned(arg);
65620         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65621         arg_conv.is_owned = false;
65622         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
65623         return ret_conv;
65624 }
65625
65626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65627         LDKFixedPenaltyScorer orig_conv;
65628         orig_conv.inner = untag_ptr(orig);
65629         orig_conv.is_owned = ptr_is_owned(orig);
65630         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65631         orig_conv.is_owned = false;
65632         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
65633         int64_t ret_ref = 0;
65634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65636         return ret_ref;
65637 }
65638
65639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
65640         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
65641         int64_t ret_ref = 0;
65642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65644         return ret_ref;
65645 }
65646
65647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
65648         LDKFixedPenaltyScorer this_arg_conv;
65649         this_arg_conv.inner = untag_ptr(this_arg);
65650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65652         this_arg_conv.is_owned = false;
65653         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
65654         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
65655         return tag_ptr(ret_ret, true);
65656 }
65657
65658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
65659         LDKFixedPenaltyScorer this_arg_conv;
65660         this_arg_conv.inner = untag_ptr(this_arg);
65661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65663         this_arg_conv.is_owned = false;
65664         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
65665         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
65666         return tag_ptr(ret_ret, true);
65667 }
65668
65669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
65670         LDKFixedPenaltyScorer obj_conv;
65671         obj_conv.inner = untag_ptr(obj);
65672         obj_conv.is_owned = ptr_is_owned(obj);
65673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65674         obj_conv.is_owned = false;
65675         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
65676         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65677         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65678         CVec_u8Z_free(ret_var);
65679         return ret_arr;
65680 }
65681
65682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
65683         LDKu8slice ser_ref;
65684         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65685         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65686         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
65687         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
65688         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65689         return tag_ptr(ret_conv, true);
65690 }
65691
65692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65693         LDKProbabilisticScorer this_obj_conv;
65694         this_obj_conv.inner = untag_ptr(this_obj);
65695         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65697         ProbabilisticScorer_free(this_obj_conv);
65698 }
65699
65700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65701         LDKProbabilisticScoringFeeParameters this_obj_conv;
65702         this_obj_conv.inner = untag_ptr(this_obj);
65703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65705         ProbabilisticScoringFeeParameters_free(this_obj_conv);
65706 }
65707
65708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65709         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65710         this_ptr_conv.inner = untag_ptr(this_ptr);
65711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65713         this_ptr_conv.is_owned = false;
65714         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
65715         return ret_conv;
65716 }
65717
65718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65719         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65720         this_ptr_conv.inner = untag_ptr(this_ptr);
65721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65723         this_ptr_conv.is_owned = false;
65724         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
65725 }
65726
65727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65728         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65729         this_ptr_conv.inner = untag_ptr(this_ptr);
65730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65732         this_ptr_conv.is_owned = false;
65733         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
65734         return ret_conv;
65735 }
65736
65737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65738         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65739         this_ptr_conv.inner = untag_ptr(this_ptr);
65740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65742         this_ptr_conv.is_owned = false;
65743         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
65744 }
65745
65746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65747         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65748         this_ptr_conv.inner = untag_ptr(this_ptr);
65749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65751         this_ptr_conv.is_owned = false;
65752         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
65753         return ret_conv;
65754 }
65755
65756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65757         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65758         this_ptr_conv.inner = untag_ptr(this_ptr);
65759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65761         this_ptr_conv.is_owned = false;
65762         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
65763 }
65764
65765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65766         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65767         this_ptr_conv.inner = untag_ptr(this_ptr);
65768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65770         this_ptr_conv.is_owned = false;
65771         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
65772         return ret_conv;
65773 }
65774
65775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65776         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65777         this_ptr_conv.inner = untag_ptr(this_ptr);
65778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65780         this_ptr_conv.is_owned = false;
65781         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
65782 }
65783
65784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65785         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65786         this_ptr_conv.inner = untag_ptr(this_ptr);
65787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65789         this_ptr_conv.is_owned = false;
65790         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
65791         return ret_conv;
65792 }
65793
65794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65795         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65796         this_ptr_conv.inner = untag_ptr(this_ptr);
65797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65799         this_ptr_conv.is_owned = false;
65800         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
65801 }
65802
65803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65804         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65805         this_ptr_conv.inner = untag_ptr(this_ptr);
65806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65808         this_ptr_conv.is_owned = false;
65809         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
65810         return ret_conv;
65811 }
65812
65813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1historical_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65814         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65815         this_ptr_conv.inner = untag_ptr(this_ptr);
65816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65818         this_ptr_conv.is_owned = false;
65819         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
65820 }
65821
65822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65823         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65824         this_ptr_conv.inner = untag_ptr(this_ptr);
65825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65827         this_ptr_conv.is_owned = false;
65828         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
65829         return ret_conv;
65830 }
65831
65832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65833         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65834         this_ptr_conv.inner = untag_ptr(this_ptr);
65835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65837         this_ptr_conv.is_owned = false;
65838         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
65839 }
65840
65841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65842         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65843         this_ptr_conv.inner = untag_ptr(this_ptr);
65844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65846         this_ptr_conv.is_owned = false;
65847         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
65848         return ret_conv;
65849 }
65850
65851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65852         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65853         this_ptr_conv.inner = untag_ptr(this_ptr);
65854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65856         this_ptr_conv.is_owned = false;
65857         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
65858 }
65859
65860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr) {
65861         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65862         this_ptr_conv.inner = untag_ptr(this_ptr);
65863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65865         this_ptr_conv.is_owned = false;
65866         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
65867         return ret_conv;
65868 }
65869
65870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
65871         LDKProbabilisticScoringFeeParameters this_ptr_conv;
65872         this_ptr_conv.inner = untag_ptr(this_ptr);
65873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65875         this_ptr_conv.is_owned = false;
65876         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
65877 }
65878
65879 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
65880         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
65881         int64_t ret_ref = 0;
65882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65884         return ret_ref;
65885 }
65886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65887         LDKProbabilisticScoringFeeParameters arg_conv;
65888         arg_conv.inner = untag_ptr(arg);
65889         arg_conv.is_owned = ptr_is_owned(arg);
65890         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65891         arg_conv.is_owned = false;
65892         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
65893         return ret_conv;
65894 }
65895
65896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65897         LDKProbabilisticScoringFeeParameters orig_conv;
65898         orig_conv.inner = untag_ptr(orig);
65899         orig_conv.is_owned = ptr_is_owned(orig);
65900         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65901         orig_conv.is_owned = false;
65902         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
65903         int64_t ret_ref = 0;
65904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65906         return ret_ref;
65907 }
65908
65909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
65910         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
65911         int64_t ret_ref = 0;
65912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65914         return ret_ref;
65915 }
65916
65917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
65918         LDKProbabilisticScoringFeeParameters this_arg_conv;
65919         this_arg_conv.inner = untag_ptr(this_arg);
65920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65922         this_arg_conv.is_owned = false;
65923         LDKNodeId node_id_conv;
65924         node_id_conv.inner = untag_ptr(node_id);
65925         node_id_conv.is_owned = ptr_is_owned(node_id);
65926         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
65927         node_id_conv.is_owned = false;
65928         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
65929 }
65930
65931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned_1from_1list(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray node_ids) {
65932         LDKProbabilisticScoringFeeParameters this_arg_conv;
65933         this_arg_conv.inner = untag_ptr(this_arg);
65934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65936         this_arg_conv.is_owned = false;
65937         LDKCVec_NodeIdZ node_ids_constr;
65938         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
65939         if (node_ids_constr.datalen > 0)
65940                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
65941         else
65942                 node_ids_constr.data = NULL;
65943         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
65944         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
65945                 int64_t node_ids_conv_8 = node_ids_vals[i];
65946                 LDKNodeId node_ids_conv_8_conv;
65947                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
65948                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
65949                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
65950                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
65951                 node_ids_constr.data[i] = node_ids_conv_8_conv;
65952         }
65953         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
65954         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
65955 }
65956
65957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
65958         LDKProbabilisticScoringFeeParameters this_arg_conv;
65959         this_arg_conv.inner = untag_ptr(this_arg);
65960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65962         this_arg_conv.is_owned = false;
65963         LDKNodeId node_id_conv;
65964         node_id_conv.inner = untag_ptr(node_id);
65965         node_id_conv.is_owned = ptr_is_owned(node_id);
65966         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
65967         node_id_conv.is_owned = false;
65968         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
65969 }
65970
65971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id, int64_t penalty) {
65972         LDKProbabilisticScoringFeeParameters this_arg_conv;
65973         this_arg_conv.inner = untag_ptr(this_arg);
65974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65976         this_arg_conv.is_owned = false;
65977         LDKNodeId node_id_conv;
65978         node_id_conv.inner = untag_ptr(node_id);
65979         node_id_conv.is_owned = ptr_is_owned(node_id);
65980         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
65981         node_id_conv.is_owned = false;
65982         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
65983 }
65984
65985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
65986         LDKProbabilisticScoringFeeParameters this_arg_conv;
65987         this_arg_conv.inner = untag_ptr(this_arg);
65988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65990         this_arg_conv.is_owned = false;
65991         LDKNodeId node_id_conv;
65992         node_id_conv.inner = untag_ptr(node_id);
65993         node_id_conv.is_owned = ptr_is_owned(node_id);
65994         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
65995         node_id_conv.is_owned = false;
65996         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
65997 }
65998
65999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
66000         LDKProbabilisticScoringFeeParameters this_arg_conv;
66001         this_arg_conv.inner = untag_ptr(this_arg);
66002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66004         this_arg_conv.is_owned = false;
66005         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
66006 }
66007
66008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66009         LDKProbabilisticScoringDecayParameters this_obj_conv;
66010         this_obj_conv.inner = untag_ptr(this_obj);
66011         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66013         ProbabilisticScoringDecayParameters_free(this_obj_conv);
66014 }
66015
66016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
66017         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66018         this_ptr_conv.inner = untag_ptr(this_ptr);
66019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66021         this_ptr_conv.is_owned = false;
66022         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
66023         return ret_conv;
66024 }
66025
66026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1set_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66027         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66028         this_ptr_conv.inner = untag_ptr(this_ptr);
66029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66031         this_ptr_conv.is_owned = false;
66032         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
66033 }
66034
66035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
66036         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66037         this_ptr_conv.inner = untag_ptr(this_ptr);
66038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66040         this_ptr_conv.is_owned = false;
66041         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
66042         return ret_conv;
66043 }
66044
66045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1set_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66046         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66047         this_ptr_conv.inner = untag_ptr(this_ptr);
66048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66050         this_ptr_conv.is_owned = false;
66051         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
66052 }
66053
66054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1new(JNIEnv *env, jclass clz, int64_t historical_no_updates_half_life_arg, int64_t liquidity_offset_half_life_arg) {
66055         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
66056         int64_t ret_ref = 0;
66057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66059         return ret_ref;
66060 }
66061
66062 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
66063         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
66064         int64_t ret_ref = 0;
66065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66067         return ret_ref;
66068 }
66069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66070         LDKProbabilisticScoringDecayParameters arg_conv;
66071         arg_conv.inner = untag_ptr(arg);
66072         arg_conv.is_owned = ptr_is_owned(arg);
66073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66074         arg_conv.is_owned = false;
66075         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
66076         return ret_conv;
66077 }
66078
66079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66080         LDKProbabilisticScoringDecayParameters orig_conv;
66081         orig_conv.inner = untag_ptr(orig);
66082         orig_conv.is_owned = ptr_is_owned(orig);
66083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66084         orig_conv.is_owned = false;
66085         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
66086         int64_t ret_ref = 0;
66087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66089         return ret_ref;
66090 }
66091
66092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
66093         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
66094         int64_t ret_ref = 0;
66095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66097         return ret_ref;
66098 }
66099
66100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t decay_params, int64_t network_graph, int64_t logger) {
66101         LDKProbabilisticScoringDecayParameters decay_params_conv;
66102         decay_params_conv.inner = untag_ptr(decay_params);
66103         decay_params_conv.is_owned = ptr_is_owned(decay_params);
66104         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
66105         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
66106         LDKNetworkGraph network_graph_conv;
66107         network_graph_conv.inner = untag_ptr(network_graph);
66108         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66109         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66110         network_graph_conv.is_owned = false;
66111         void* logger_ptr = untag_ptr(logger);
66112         CHECK_ACCESS(logger_ptr);
66113         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66114         if (logger_conv.free == LDKLogger_JCalls_free) {
66115                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66116                 LDKLogger_JCalls_cloned(&logger_conv);
66117         }
66118         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
66119         int64_t ret_ref = 0;
66120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66122         return ret_ref;
66123 }
66124
66125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
66126         LDKProbabilisticScorer this_arg_conv;
66127         this_arg_conv.inner = untag_ptr(this_arg);
66128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66130         this_arg_conv.is_owned = false;
66131         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
66132 }
66133
66134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1estimated_1channel_1liquidity_1range(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) {
66135         LDKProbabilisticScorer this_arg_conv;
66136         this_arg_conv.inner = untag_ptr(this_arg);
66137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66139         this_arg_conv.is_owned = false;
66140         LDKNodeId target_conv;
66141         target_conv.inner = untag_ptr(target);
66142         target_conv.is_owned = ptr_is_owned(target);
66143         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66144         target_conv.is_owned = false;
66145         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
66146         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
66147         int64_t ret_ref = tag_ptr(ret_copy, true);
66148         return ret_ref;
66149 }
66150
66151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1historical_1estimated_1channel_1liquidity_1probabilities(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) {
66152         LDKProbabilisticScorer this_arg_conv;
66153         this_arg_conv.inner = untag_ptr(this_arg);
66154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66156         this_arg_conv.is_owned = false;
66157         LDKNodeId target_conv;
66158         target_conv.inner = untag_ptr(target);
66159         target_conv.is_owned = ptr_is_owned(target);
66160         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66161         target_conv.is_owned = false;
66162         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
66163         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
66164         int64_t ret_ref = tag_ptr(ret_copy, true);
66165         return ret_ref;
66166 }
66167
66168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1historical_1estimated_1payment_1success_1probability(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target, int64_t amount_msat, int64_t params) {
66169         LDKProbabilisticScorer this_arg_conv;
66170         this_arg_conv.inner = untag_ptr(this_arg);
66171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66173         this_arg_conv.is_owned = false;
66174         LDKNodeId target_conv;
66175         target_conv.inner = untag_ptr(target);
66176         target_conv.is_owned = ptr_is_owned(target);
66177         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66178         target_conv.is_owned = false;
66179         LDKProbabilisticScoringFeeParameters params_conv;
66180         params_conv.inner = untag_ptr(params);
66181         params_conv.is_owned = ptr_is_owned(params);
66182         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
66183         params_conv.is_owned = false;
66184         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
66185         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
66186         int64_t ret_ref = tag_ptr(ret_copy, true);
66187         return ret_ref;
66188 }
66189
66190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
66191         LDKProbabilisticScorer this_arg_conv;
66192         this_arg_conv.inner = untag_ptr(this_arg);
66193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66195         this_arg_conv.is_owned = false;
66196         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66197         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
66198         return tag_ptr(ret_ret, true);
66199 }
66200
66201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
66202         LDKProbabilisticScorer this_arg_conv;
66203         this_arg_conv.inner = untag_ptr(this_arg);
66204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66206         this_arg_conv.is_owned = false;
66207         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66208         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
66209         return tag_ptr(ret_ret, true);
66210 }
66211
66212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
66213         LDKProbabilisticScorer this_arg_conv;
66214         this_arg_conv.inner = untag_ptr(this_arg);
66215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66217         this_arg_conv.is_owned = false;
66218         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
66219         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
66220         return tag_ptr(ret_ret, true);
66221 }
66222
66223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
66224         LDKProbabilisticScorer obj_conv;
66225         obj_conv.inner = untag_ptr(obj);
66226         obj_conv.is_owned = ptr_is_owned(obj);
66227         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66228         obj_conv.is_owned = false;
66229         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
66230         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66231         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66232         CVec_u8Z_free(ret_var);
66233         return ret_arr;
66234 }
66235
66236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c) {
66237         LDKu8slice ser_ref;
66238         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66239         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66240         LDKProbabilisticScoringDecayParameters arg_a_conv;
66241         arg_a_conv.inner = untag_ptr(arg_a);
66242         arg_a_conv.is_owned = ptr_is_owned(arg_a);
66243         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
66244         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
66245         LDKNetworkGraph arg_b_conv;
66246         arg_b_conv.inner = untag_ptr(arg_b);
66247         arg_b_conv.is_owned = ptr_is_owned(arg_b);
66248         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
66249         arg_b_conv.is_owned = false;
66250         void* arg_c_ptr = untag_ptr(arg_c);
66251         CHECK_ACCESS(arg_c_ptr);
66252         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
66253         if (arg_c_conv.free == LDKLogger_JCalls_free) {
66254                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66255                 LDKLogger_JCalls_cloned(&arg_c_conv);
66256         }
66257         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
66258         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
66259         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66260         return tag_ptr(ret_conv, true);
66261 }
66262
66263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66264         LDKDelayedPaymentOutputDescriptor this_obj_conv;
66265         this_obj_conv.inner = untag_ptr(this_obj);
66266         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66268         DelayedPaymentOutputDescriptor_free(this_obj_conv);
66269 }
66270
66271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66272         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66273         this_ptr_conv.inner = untag_ptr(this_ptr);
66274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66276         this_ptr_conv.is_owned = false;
66277         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
66278         int64_t ret_ref = 0;
66279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66281         return ret_ref;
66282 }
66283
66284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66285         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66286         this_ptr_conv.inner = untag_ptr(this_ptr);
66287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66289         this_ptr_conv.is_owned = false;
66290         LDKOutPoint val_conv;
66291         val_conv.inner = untag_ptr(val);
66292         val_conv.is_owned = ptr_is_owned(val);
66293         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66294         val_conv = OutPoint_clone(&val_conv);
66295         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
66296 }
66297
66298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
66299         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66300         this_ptr_conv.inner = untag_ptr(this_ptr);
66301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66303         this_ptr_conv.is_owned = false;
66304         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66305         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
66306         return ret_arr;
66307 }
66308
66309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66310         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66311         this_ptr_conv.inner = untag_ptr(this_ptr);
66312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66314         this_ptr_conv.is_owned = false;
66315         LDKPublicKey val_ref;
66316         CHECK((*env)->GetArrayLength(env, val) == 33);
66317         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
66318         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
66319 }
66320
66321 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
66322         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66323         this_ptr_conv.inner = untag_ptr(this_ptr);
66324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66326         this_ptr_conv.is_owned = false;
66327         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
66328         return ret_conv;
66329 }
66330
66331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
66332         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66333         this_ptr_conv.inner = untag_ptr(this_ptr);
66334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66336         this_ptr_conv.is_owned = false;
66337         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
66338 }
66339
66340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
66341         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66342         this_ptr_conv.inner = untag_ptr(this_ptr);
66343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66345         this_ptr_conv.is_owned = false;
66346         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66347         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
66348         return tag_ptr(ret_ref, true);
66349 }
66350
66351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66352         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66353         this_ptr_conv.inner = untag_ptr(this_ptr);
66354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66356         this_ptr_conv.is_owned = false;
66357         void* val_ptr = untag_ptr(val);
66358         CHECK_ACCESS(val_ptr);
66359         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66360         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66361         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
66362 }
66363
66364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
66365         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66366         this_ptr_conv.inner = untag_ptr(this_ptr);
66367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66369         this_ptr_conv.is_owned = false;
66370         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66371         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
66372         return ret_arr;
66373 }
66374
66375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66376         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66377         this_ptr_conv.inner = untag_ptr(this_ptr);
66378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66380         this_ptr_conv.is_owned = false;
66381         LDKPublicKey val_ref;
66382         CHECK((*env)->GetArrayLength(env, val) == 33);
66383         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
66384         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
66385 }
66386
66387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
66388         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66389         this_ptr_conv.inner = untag_ptr(this_ptr);
66390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66392         this_ptr_conv.is_owned = false;
66393         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66394         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
66395         return ret_arr;
66396 }
66397
66398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66399         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66400         this_ptr_conv.inner = untag_ptr(this_ptr);
66401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66403         this_ptr_conv.is_owned = false;
66404         LDKThirtyTwoBytes val_ref;
66405         CHECK((*env)->GetArrayLength(env, val) == 32);
66406         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
66407         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
66408 }
66409
66410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
66411         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66412         this_ptr_conv.inner = untag_ptr(this_ptr);
66413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66415         this_ptr_conv.is_owned = false;
66416         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
66417         return ret_conv;
66418 }
66419
66420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66421         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66422         this_ptr_conv.inner = untag_ptr(this_ptr);
66423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66425         this_ptr_conv.is_owned = false;
66426         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
66427 }
66428
66429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
66430         LDKOutPoint outpoint_arg_conv;
66431         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66432         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66433         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66434         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66435         LDKPublicKey per_commitment_point_arg_ref;
66436         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
66437         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
66438         void* output_arg_ptr = untag_ptr(output_arg);
66439         CHECK_ACCESS(output_arg_ptr);
66440         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
66441         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
66442         LDKPublicKey revocation_pubkey_arg_ref;
66443         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
66444         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
66445         LDKThirtyTwoBytes channel_keys_id_arg_ref;
66446         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
66447         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
66448         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
66449         int64_t ret_ref = 0;
66450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66452         return ret_ref;
66453 }
66454
66455 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
66456         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
66457         int64_t ret_ref = 0;
66458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66460         return ret_ref;
66461 }
66462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66463         LDKDelayedPaymentOutputDescriptor arg_conv;
66464         arg_conv.inner = untag_ptr(arg);
66465         arg_conv.is_owned = ptr_is_owned(arg);
66466         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66467         arg_conv.is_owned = false;
66468         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
66469         return ret_conv;
66470 }
66471
66472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66473         LDKDelayedPaymentOutputDescriptor orig_conv;
66474         orig_conv.inner = untag_ptr(orig);
66475         orig_conv.is_owned = ptr_is_owned(orig);
66476         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66477         orig_conv.is_owned = false;
66478         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
66479         int64_t ret_ref = 0;
66480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66482         return ret_ref;
66483 }
66484
66485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
66486         LDKDelayedPaymentOutputDescriptor o_conv;
66487         o_conv.inner = untag_ptr(o);
66488         o_conv.is_owned = ptr_is_owned(o);
66489         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66490         o_conv.is_owned = false;
66491         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
66492         return ret_conv;
66493 }
66494
66495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66496         LDKDelayedPaymentOutputDescriptor a_conv;
66497         a_conv.inner = untag_ptr(a);
66498         a_conv.is_owned = ptr_is_owned(a);
66499         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66500         a_conv.is_owned = false;
66501         LDKDelayedPaymentOutputDescriptor b_conv;
66502         b_conv.inner = untag_ptr(b);
66503         b_conv.is_owned = ptr_is_owned(b);
66504         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66505         b_conv.is_owned = false;
66506         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
66507         return ret_conv;
66508 }
66509
66510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
66511         LDKDelayedPaymentOutputDescriptor obj_conv;
66512         obj_conv.inner = untag_ptr(obj);
66513         obj_conv.is_owned = ptr_is_owned(obj);
66514         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66515         obj_conv.is_owned = false;
66516         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
66517         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66518         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66519         CVec_u8Z_free(ret_var);
66520         return ret_arr;
66521 }
66522
66523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66524         LDKu8slice ser_ref;
66525         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66526         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66527         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
66528         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
66529         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66530         return tag_ptr(ret_conv, true);
66531 }
66532
66533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66534         LDKStaticPaymentOutputDescriptor this_obj_conv;
66535         this_obj_conv.inner = untag_ptr(this_obj);
66536         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66538         StaticPaymentOutputDescriptor_free(this_obj_conv);
66539 }
66540
66541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66542         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66543         this_ptr_conv.inner = untag_ptr(this_ptr);
66544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66546         this_ptr_conv.is_owned = false;
66547         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
66548         int64_t ret_ref = 0;
66549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66551         return ret_ref;
66552 }
66553
66554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66555         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66556         this_ptr_conv.inner = untag_ptr(this_ptr);
66557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66559         this_ptr_conv.is_owned = false;
66560         LDKOutPoint val_conv;
66561         val_conv.inner = untag_ptr(val);
66562         val_conv.is_owned = ptr_is_owned(val);
66563         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66564         val_conv = OutPoint_clone(&val_conv);
66565         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
66566 }
66567
66568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
66569         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66570         this_ptr_conv.inner = untag_ptr(this_ptr);
66571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66573         this_ptr_conv.is_owned = false;
66574         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66575         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
66576         return tag_ptr(ret_ref, true);
66577 }
66578
66579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66580         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66581         this_ptr_conv.inner = untag_ptr(this_ptr);
66582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66584         this_ptr_conv.is_owned = false;
66585         void* val_ptr = untag_ptr(val);
66586         CHECK_ACCESS(val_ptr);
66587         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66588         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66589         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
66590 }
66591
66592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
66593         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66594         this_ptr_conv.inner = untag_ptr(this_ptr);
66595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66597         this_ptr_conv.is_owned = false;
66598         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66599         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
66600         return ret_arr;
66601 }
66602
66603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66604         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66605         this_ptr_conv.inner = untag_ptr(this_ptr);
66606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66608         this_ptr_conv.is_owned = false;
66609         LDKThirtyTwoBytes val_ref;
66610         CHECK((*env)->GetArrayLength(env, val) == 32);
66611         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
66612         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
66613 }
66614
66615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
66616         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66617         this_ptr_conv.inner = untag_ptr(this_ptr);
66618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66620         this_ptr_conv.is_owned = false;
66621         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
66622         return ret_conv;
66623 }
66624
66625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66626         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66627         this_ptr_conv.inner = untag_ptr(this_ptr);
66628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66630         this_ptr_conv.is_owned = false;
66631         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
66632 }
66633
66634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
66635         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66636         this_ptr_conv.inner = untag_ptr(this_ptr);
66637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66639         this_ptr_conv.is_owned = false;
66640         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
66641         int64_t ret_ref = 0;
66642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66644         return ret_ref;
66645 }
66646
66647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66648         LDKStaticPaymentOutputDescriptor this_ptr_conv;
66649         this_ptr_conv.inner = untag_ptr(this_ptr);
66650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66652         this_ptr_conv.is_owned = false;
66653         LDKChannelTransactionParameters val_conv;
66654         val_conv.inner = untag_ptr(val);
66655         val_conv.is_owned = ptr_is_owned(val);
66656         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66657         val_conv = ChannelTransactionParameters_clone(&val_conv);
66658         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
66659 }
66660
66661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg, int64_t channel_transaction_parameters_arg) {
66662         LDKOutPoint outpoint_arg_conv;
66663         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66664         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66665         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66666         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66667         void* output_arg_ptr = untag_ptr(output_arg);
66668         CHECK_ACCESS(output_arg_ptr);
66669         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
66670         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
66671         LDKThirtyTwoBytes channel_keys_id_arg_ref;
66672         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
66673         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
66674         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
66675         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
66676         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
66677         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
66678         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
66679         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg, channel_transaction_parameters_arg_conv);
66680         int64_t ret_ref = 0;
66681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66683         return ret_ref;
66684 }
66685
66686 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
66687         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
66688         int64_t ret_ref = 0;
66689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66691         return ret_ref;
66692 }
66693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66694         LDKStaticPaymentOutputDescriptor arg_conv;
66695         arg_conv.inner = untag_ptr(arg);
66696         arg_conv.is_owned = ptr_is_owned(arg);
66697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66698         arg_conv.is_owned = false;
66699         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
66700         return ret_conv;
66701 }
66702
66703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66704         LDKStaticPaymentOutputDescriptor orig_conv;
66705         orig_conv.inner = untag_ptr(orig);
66706         orig_conv.is_owned = ptr_is_owned(orig);
66707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66708         orig_conv.is_owned = false;
66709         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
66710         int64_t ret_ref = 0;
66711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66713         return ret_ref;
66714 }
66715
66716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
66717         LDKStaticPaymentOutputDescriptor o_conv;
66718         o_conv.inner = untag_ptr(o);
66719         o_conv.is_owned = ptr_is_owned(o);
66720         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66721         o_conv.is_owned = false;
66722         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
66723         return ret_conv;
66724 }
66725
66726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66727         LDKStaticPaymentOutputDescriptor a_conv;
66728         a_conv.inner = untag_ptr(a);
66729         a_conv.is_owned = ptr_is_owned(a);
66730         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66731         a_conv.is_owned = false;
66732         LDKStaticPaymentOutputDescriptor b_conv;
66733         b_conv.inner = untag_ptr(b);
66734         b_conv.is_owned = ptr_is_owned(b);
66735         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66736         b_conv.is_owned = false;
66737         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
66738         return ret_conv;
66739 }
66740
66741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66742         LDKStaticPaymentOutputDescriptor this_arg_conv;
66743         this_arg_conv.inner = untag_ptr(this_arg);
66744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66746         this_arg_conv.is_owned = false;
66747         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66748         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
66749         int64_t ret_ref = tag_ptr(ret_copy, true);
66750         return ret_ref;
66751 }
66752
66753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1max_1witness_1length(JNIEnv *env, jclass clz, int64_t this_arg) {
66754         LDKStaticPaymentOutputDescriptor this_arg_conv;
66755         this_arg_conv.inner = untag_ptr(this_arg);
66756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66758         this_arg_conv.is_owned = false;
66759         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
66760         return ret_conv;
66761 }
66762
66763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
66764         LDKStaticPaymentOutputDescriptor obj_conv;
66765         obj_conv.inner = untag_ptr(obj);
66766         obj_conv.is_owned = ptr_is_owned(obj);
66767         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66768         obj_conv.is_owned = false;
66769         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
66770         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66771         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66772         CVec_u8Z_free(ret_var);
66773         return ret_arr;
66774 }
66775
66776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66777         LDKu8slice ser_ref;
66778         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66779         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66780         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
66781         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
66782         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66783         return tag_ptr(ret_conv, true);
66784 }
66785
66786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66787         if (!ptr_is_owned(this_ptr)) return;
66788         void* this_ptr_ptr = untag_ptr(this_ptr);
66789         CHECK_ACCESS(this_ptr_ptr);
66790         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
66791         FREE(untag_ptr(this_ptr));
66792         SpendableOutputDescriptor_free(this_ptr_conv);
66793 }
66794
66795 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
66796         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66797         *ret_copy = SpendableOutputDescriptor_clone(arg);
66798         int64_t ret_ref = tag_ptr(ret_copy, true);
66799         return ret_ref;
66800 }
66801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66802         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
66803         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
66804         return ret_conv;
66805 }
66806
66807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66808         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
66809         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66810         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
66811         int64_t ret_ref = tag_ptr(ret_copy, true);
66812         return ret_ref;
66813 }
66814
66815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
66816         LDKOutPoint outpoint_conv;
66817         outpoint_conv.inner = untag_ptr(outpoint);
66818         outpoint_conv.is_owned = ptr_is_owned(outpoint);
66819         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
66820         outpoint_conv = OutPoint_clone(&outpoint_conv);
66821         void* output_ptr = untag_ptr(output);
66822         CHECK_ACCESS(output_ptr);
66823         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
66824         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
66825         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66826         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
66827         int64_t ret_ref = tag_ptr(ret_copy, true);
66828         return ret_ref;
66829 }
66830
66831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
66832         LDKDelayedPaymentOutputDescriptor a_conv;
66833         a_conv.inner = untag_ptr(a);
66834         a_conv.is_owned = ptr_is_owned(a);
66835         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66836         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
66837         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66838         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
66839         int64_t ret_ref = tag_ptr(ret_copy, true);
66840         return ret_ref;
66841 }
66842
66843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
66844         LDKStaticPaymentOutputDescriptor a_conv;
66845         a_conv.inner = untag_ptr(a);
66846         a_conv.is_owned = ptr_is_owned(a);
66847         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66848         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
66849         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
66850         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
66851         int64_t ret_ref = tag_ptr(ret_copy, true);
66852         return ret_ref;
66853 }
66854
66855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
66856         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
66857         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
66858         return ret_conv;
66859 }
66860
66861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66862         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
66863         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
66864         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
66865         return ret_conv;
66866 }
66867
66868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
66869         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
66870         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
66871         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66872         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66873         CVec_u8Z_free(ret_var);
66874         return ret_arr;
66875 }
66876
66877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66878         LDKu8slice ser_ref;
66879         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66880         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66881         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
66882         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
66883         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66884         return tag_ptr(ret_conv, true);
66885 }
66886
66887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1create_1spendable_1outputs_1psbt(JNIEnv *env, jclass clz, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
66888         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
66889         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
66890         if (descriptors_constr.datalen > 0)
66891                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
66892         else
66893                 descriptors_constr.data = NULL;
66894         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
66895         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
66896                 int64_t descriptors_conv_27 = descriptors_vals[b];
66897                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
66898                 CHECK_ACCESS(descriptors_conv_27_ptr);
66899                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
66900                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
66901                 descriptors_constr.data[b] = descriptors_conv_27_conv;
66902         }
66903         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
66904         LDKCVec_TxOutZ outputs_constr;
66905         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
66906         if (outputs_constr.datalen > 0)
66907                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
66908         else
66909                 outputs_constr.data = NULL;
66910         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
66911         for (size_t h = 0; h < outputs_constr.datalen; h++) {
66912                 int64_t outputs_conv_7 = outputs_vals[h];
66913                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
66914                 CHECK_ACCESS(outputs_conv_7_ptr);
66915                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
66916                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
66917                 outputs_constr.data[h] = outputs_conv_7_conv;
66918         }
66919         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
66920         LDKCVec_u8Z change_destination_script_ref;
66921         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
66922         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
66923         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
66924         void* locktime_ptr = untag_ptr(locktime);
66925         CHECK_ACCESS(locktime_ptr);
66926         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
66927         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
66928         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
66929         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
66930         return tag_ptr(ret_conv, true);
66931 }
66932
66933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66934         if (!ptr_is_owned(this_ptr)) return;
66935         void* this_ptr_ptr = untag_ptr(this_ptr);
66936         CHECK_ACCESS(this_ptr_ptr);
66937         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
66938         FREE(untag_ptr(this_ptr));
66939         ChannelSigner_free(this_ptr_conv);
66940 }
66941
66942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66943         if (!ptr_is_owned(this_ptr)) return;
66944         void* this_ptr_ptr = untag_ptr(this_ptr);
66945         CHECK_ACCESS(this_ptr_ptr);
66946         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
66947         FREE(untag_ptr(this_ptr));
66948         EcdsaChannelSigner_free(this_ptr_conv);
66949 }
66950
66951 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
66952         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66953         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
66954         return tag_ptr(ret_ret, true);
66955 }
66956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66957         void* arg_ptr = untag_ptr(arg);
66958         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
66959         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
66960         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
66961         return ret_conv;
66962 }
66963
66964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66965         void* orig_ptr = untag_ptr(orig);
66966         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
66967         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
66968         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66969         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
66970         return tag_ptr(ret_ret, true);
66971 }
66972
66973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66974         if (!ptr_is_owned(this_ptr)) return;
66975         void* this_ptr_ptr = untag_ptr(this_ptr);
66976         CHECK_ACCESS(this_ptr_ptr);
66977         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
66978         FREE(untag_ptr(this_ptr));
66979         WriteableEcdsaChannelSigner_free(this_ptr_conv);
66980 }
66981
66982 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66983         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
66984         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
66985         return ret_conv;
66986 }
66987
66988 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
66989         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
66990         return ret_conv;
66991 }
66992
66993 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
66994         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
66995         return ret_conv;
66996 }
66997
66998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66999         if (!ptr_is_owned(this_ptr)) return;
67000         void* this_ptr_ptr = untag_ptr(this_ptr);
67001         CHECK_ACCESS(this_ptr_ptr);
67002         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
67003         FREE(untag_ptr(this_ptr));
67004         EntropySource_free(this_ptr_conv);
67005 }
67006
67007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67008         if (!ptr_is_owned(this_ptr)) return;
67009         void* this_ptr_ptr = untag_ptr(this_ptr);
67010         CHECK_ACCESS(this_ptr_ptr);
67011         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
67012         FREE(untag_ptr(this_ptr));
67013         NodeSigner_free(this_ptr_conv);
67014 }
67015
67016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67017         if (!ptr_is_owned(this_ptr)) return;
67018         void* this_ptr_ptr = untag_ptr(this_ptr);
67019         CHECK_ACCESS(this_ptr_ptr);
67020         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
67021         FREE(untag_ptr(this_ptr));
67022         SignerProvider_free(this_ptr_conv);
67023 }
67024
67025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67026         LDKInMemorySigner this_obj_conv;
67027         this_obj_conv.inner = untag_ptr(this_obj);
67028         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67030         InMemorySigner_free(this_obj_conv);
67031 }
67032
67033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67034         LDKInMemorySigner this_ptr_conv;
67035         this_ptr_conv.inner = untag_ptr(this_ptr);
67036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67038         this_ptr_conv.is_owned = false;
67039         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67040         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
67041         return ret_arr;
67042 }
67043
67044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67045         LDKInMemorySigner this_ptr_conv;
67046         this_ptr_conv.inner = untag_ptr(this_ptr);
67047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67049         this_ptr_conv.is_owned = false;
67050         LDKSecretKey val_ref;
67051         CHECK((*env)->GetArrayLength(env, val) == 32);
67052         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67053         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
67054 }
67055
67056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67057         LDKInMemorySigner this_ptr_conv;
67058         this_ptr_conv.inner = untag_ptr(this_ptr);
67059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67061         this_ptr_conv.is_owned = false;
67062         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67063         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
67064         return ret_arr;
67065 }
67066
67067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67068         LDKInMemorySigner this_ptr_conv;
67069         this_ptr_conv.inner = untag_ptr(this_ptr);
67070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67072         this_ptr_conv.is_owned = false;
67073         LDKSecretKey val_ref;
67074         CHECK((*env)->GetArrayLength(env, val) == 32);
67075         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67076         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
67077 }
67078
67079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67080         LDKInMemorySigner this_ptr_conv;
67081         this_ptr_conv.inner = untag_ptr(this_ptr);
67082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67084         this_ptr_conv.is_owned = false;
67085         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67086         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
67087         return ret_arr;
67088 }
67089
67090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67091         LDKInMemorySigner this_ptr_conv;
67092         this_ptr_conv.inner = untag_ptr(this_ptr);
67093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67095         this_ptr_conv.is_owned = false;
67096         LDKSecretKey val_ref;
67097         CHECK((*env)->GetArrayLength(env, val) == 32);
67098         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67099         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
67100 }
67101
67102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67103         LDKInMemorySigner this_ptr_conv;
67104         this_ptr_conv.inner = untag_ptr(this_ptr);
67105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67107         this_ptr_conv.is_owned = false;
67108         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67109         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
67110         return ret_arr;
67111 }
67112
67113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67114         LDKInMemorySigner this_ptr_conv;
67115         this_ptr_conv.inner = untag_ptr(this_ptr);
67116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67118         this_ptr_conv.is_owned = false;
67119         LDKSecretKey val_ref;
67120         CHECK((*env)->GetArrayLength(env, val) == 32);
67121         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67122         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
67123 }
67124
67125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
67126         LDKInMemorySigner this_ptr_conv;
67127         this_ptr_conv.inner = untag_ptr(this_ptr);
67128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67130         this_ptr_conv.is_owned = false;
67131         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67132         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
67133         return ret_arr;
67134 }
67135
67136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67137         LDKInMemorySigner this_ptr_conv;
67138         this_ptr_conv.inner = untag_ptr(this_ptr);
67139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67141         this_ptr_conv.is_owned = false;
67142         LDKSecretKey val_ref;
67143         CHECK((*env)->GetArrayLength(env, val) == 32);
67144         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
67145         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
67146 }
67147
67148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
67149         LDKInMemorySigner this_ptr_conv;
67150         this_ptr_conv.inner = untag_ptr(this_ptr);
67151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67153         this_ptr_conv.is_owned = false;
67154         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67155         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
67156         return ret_arr;
67157 }
67158
67159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67160         LDKInMemorySigner this_ptr_conv;
67161         this_ptr_conv.inner = untag_ptr(this_ptr);
67162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67164         this_ptr_conv.is_owned = false;
67165         LDKThirtyTwoBytes val_ref;
67166         CHECK((*env)->GetArrayLength(env, val) == 32);
67167         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
67168         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
67169 }
67170
67171 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
67172         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
67173         int64_t ret_ref = 0;
67174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67176         return ret_ref;
67177 }
67178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67179         LDKInMemorySigner arg_conv;
67180         arg_conv.inner = untag_ptr(arg);
67181         arg_conv.is_owned = ptr_is_owned(arg);
67182         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67183         arg_conv.is_owned = false;
67184         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
67185         return ret_conv;
67186 }
67187
67188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67189         LDKInMemorySigner orig_conv;
67190         orig_conv.inner = untag_ptr(orig);
67191         orig_conv.is_owned = ptr_is_owned(orig);
67192         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67193         orig_conv.is_owned = false;
67194         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
67195         int64_t ret_ref = 0;
67196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67198         return ret_ref;
67199 }
67200
67201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id, int8_tArray rand_bytes_unique_start) {
67202         LDKSecretKey funding_key_ref;
67203         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
67204         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
67205         LDKSecretKey revocation_base_key_ref;
67206         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
67207         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
67208         LDKSecretKey payment_key_ref;
67209         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
67210         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
67211         LDKSecretKey delayed_payment_base_key_ref;
67212         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
67213         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
67214         LDKSecretKey htlc_base_key_ref;
67215         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
67216         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
67217         LDKThirtyTwoBytes commitment_seed_ref;
67218         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
67219         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
67220         LDKThirtyTwoBytes channel_keys_id_ref;
67221         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
67222         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
67223         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
67224         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
67225         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
67226         LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref, rand_bytes_unique_start_ref);
67227         int64_t ret_ref = 0;
67228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67230         return ret_ref;
67231 }
67232
67233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
67234         LDKInMemorySigner this_arg_conv;
67235         this_arg_conv.inner = untag_ptr(this_arg);
67236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67238         this_arg_conv.is_owned = false;
67239         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
67240         int64_t ret_ref = 0;
67241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67243         return ret_ref;
67244 }
67245
67246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
67247         LDKInMemorySigner this_arg_conv;
67248         this_arg_conv.inner = untag_ptr(this_arg);
67249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67251         this_arg_conv.is_owned = false;
67252         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
67253         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
67254         int64_t ret_ref = tag_ptr(ret_copy, true);
67255         return ret_ref;
67256 }
67257
67258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
67259         LDKInMemorySigner this_arg_conv;
67260         this_arg_conv.inner = untag_ptr(this_arg);
67261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67263         this_arg_conv.is_owned = false;
67264         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
67265         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
67266         int64_t ret_ref = tag_ptr(ret_copy, true);
67267         return ret_ref;
67268 }
67269
67270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
67271         LDKInMemorySigner this_arg_conv;
67272         this_arg_conv.inner = untag_ptr(this_arg);
67273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67275         this_arg_conv.is_owned = false;
67276         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
67277         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
67278         int64_t ret_ref = tag_ptr(ret_copy, true);
67279         return ret_ref;
67280 }
67281
67282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
67283         LDKInMemorySigner this_arg_conv;
67284         this_arg_conv.inner = untag_ptr(this_arg);
67285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67287         this_arg_conv.is_owned = false;
67288         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
67289         int64_t ret_ref = 0;
67290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67292         return ret_ref;
67293 }
67294
67295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
67296         LDKInMemorySigner this_arg_conv;
67297         this_arg_conv.inner = untag_ptr(this_arg);
67298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67300         this_arg_conv.is_owned = false;
67301         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
67302         int64_t ret_ref = 0;
67303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67305         return ret_ref;
67306 }
67307
67308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
67309         LDKInMemorySigner this_arg_conv;
67310         this_arg_conv.inner = untag_ptr(this_arg);
67311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67313         this_arg_conv.is_owned = false;
67314         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
67315         int64_t ret_ref = 0;
67316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67318         return ret_ref;
67319 }
67320
67321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
67322         LDKInMemorySigner this_arg_conv;
67323         this_arg_conv.inner = untag_ptr(this_arg);
67324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67326         this_arg_conv.is_owned = false;
67327         LDKTransaction spend_tx_ref;
67328         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
67329         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
67330         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
67331         spend_tx_ref.data_is_owned = true;
67332         LDKStaticPaymentOutputDescriptor descriptor_conv;
67333         descriptor_conv.inner = untag_ptr(descriptor);
67334         descriptor_conv.is_owned = ptr_is_owned(descriptor);
67335         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
67336         descriptor_conv.is_owned = false;
67337         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
67338         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
67339         return tag_ptr(ret_conv, true);
67340 }
67341
67342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
67343         LDKInMemorySigner this_arg_conv;
67344         this_arg_conv.inner = untag_ptr(this_arg);
67345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67347         this_arg_conv.is_owned = false;
67348         LDKTransaction spend_tx_ref;
67349         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
67350         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
67351         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
67352         spend_tx_ref.data_is_owned = true;
67353         LDKDelayedPaymentOutputDescriptor descriptor_conv;
67354         descriptor_conv.inner = untag_ptr(descriptor);
67355         descriptor_conv.is_owned = ptr_is_owned(descriptor);
67356         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
67357         descriptor_conv.is_owned = false;
67358         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
67359         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
67360         return tag_ptr(ret_conv, true);
67361 }
67362
67363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
67364         LDKInMemorySigner this_arg_conv;
67365         this_arg_conv.inner = untag_ptr(this_arg);
67366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67368         this_arg_conv.is_owned = false;
67369         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
67370         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
67371         return tag_ptr(ret_ret, true);
67372 }
67373
67374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67375         LDKInMemorySigner this_arg_conv;
67376         this_arg_conv.inner = untag_ptr(this_arg);
67377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67379         this_arg_conv.is_owned = false;
67380         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
67381         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
67382         return tag_ptr(ret_ret, true);
67383 }
67384
67385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67386         LDKInMemorySigner this_arg_conv;
67387         this_arg_conv.inner = untag_ptr(this_arg);
67388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67390         this_arg_conv.is_owned = false;
67391         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
67392         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
67393         return tag_ptr(ret_ret, true);
67394 }
67395
67396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67397         LDKInMemorySigner this_arg_conv;
67398         this_arg_conv.inner = untag_ptr(this_arg);
67399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67401         this_arg_conv.is_owned = false;
67402         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
67403         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
67404         return tag_ptr(ret_ret, true);
67405 }
67406
67407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
67408         LDKInMemorySigner obj_conv;
67409         obj_conv.inner = untag_ptr(obj);
67410         obj_conv.is_owned = ptr_is_owned(obj);
67411         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67412         obj_conv.is_owned = false;
67413         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
67414         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67415         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67416         CVec_u8Z_free(ret_var);
67417         return ret_arr;
67418 }
67419
67420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
67421         LDKu8slice ser_ref;
67422         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67423         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67424         void* arg_ptr = untag_ptr(arg);
67425         CHECK_ACCESS(arg_ptr);
67426         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
67427         if (arg_conv.free == LDKEntropySource_JCalls_free) {
67428                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67429                 LDKEntropySource_JCalls_cloned(&arg_conv);
67430         }
67431         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
67432         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
67433         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67434         return tag_ptr(ret_conv, true);
67435 }
67436
67437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67438         LDKKeysManager this_obj_conv;
67439         this_obj_conv.inner = untag_ptr(this_obj);
67440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67442         KeysManager_free(this_obj_conv);
67443 }
67444
67445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
67446         uint8_t seed_arr[32];
67447         CHECK((*env)->GetArrayLength(env, seed) == 32);
67448         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
67449         uint8_t (*seed_ref)[32] = &seed_arr;
67450         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
67451         int64_t ret_ref = 0;
67452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67454         return ret_ref;
67455 }
67456
67457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
67458         LDKKeysManager this_arg_conv;
67459         this_arg_conv.inner = untag_ptr(this_arg);
67460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67462         this_arg_conv.is_owned = false;
67463         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67464         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
67465         return ret_arr;
67466 }
67467
67468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
67469         LDKKeysManager this_arg_conv;
67470         this_arg_conv.inner = untag_ptr(this_arg);
67471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67473         this_arg_conv.is_owned = false;
67474         uint8_t params_arr[32];
67475         CHECK((*env)->GetArrayLength(env, params) == 32);
67476         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
67477         uint8_t (*params_ref)[32] = &params_arr;
67478         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
67479         int64_t ret_ref = 0;
67480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67482         return ret_ref;
67483 }
67484
67485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1sign_1spendable_1outputs_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int8_tArray psbt) {
67486         LDKKeysManager this_arg_conv;
67487         this_arg_conv.inner = untag_ptr(this_arg);
67488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67490         this_arg_conv.is_owned = false;
67491         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
67492         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
67493         if (descriptors_constr.datalen > 0)
67494                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
67495         else
67496                 descriptors_constr.data = NULL;
67497         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
67498         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
67499                 int64_t descriptors_conv_27 = descriptors_vals[b];
67500                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
67501                 CHECK_ACCESS(descriptors_conv_27_ptr);
67502                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
67503                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
67504                 descriptors_constr.data[b] = descriptors_conv_27_conv;
67505         }
67506         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
67507         LDKCVec_u8Z psbt_ref;
67508         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
67509         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
67510         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
67511         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
67512         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
67513         return tag_ptr(ret_conv, true);
67514 }
67515
67516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
67517         LDKKeysManager this_arg_conv;
67518         this_arg_conv.inner = untag_ptr(this_arg);
67519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67521         this_arg_conv.is_owned = false;
67522         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
67523         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
67524         if (descriptors_constr.datalen > 0)
67525                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
67526         else
67527                 descriptors_constr.data = NULL;
67528         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
67529         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
67530                 int64_t descriptors_conv_27 = descriptors_vals[b];
67531                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
67532                 CHECK_ACCESS(descriptors_conv_27_ptr);
67533                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
67534                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
67535                 descriptors_constr.data[b] = descriptors_conv_27_conv;
67536         }
67537         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
67538         LDKCVec_TxOutZ outputs_constr;
67539         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
67540         if (outputs_constr.datalen > 0)
67541                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
67542         else
67543                 outputs_constr.data = NULL;
67544         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
67545         for (size_t h = 0; h < outputs_constr.datalen; h++) {
67546                 int64_t outputs_conv_7 = outputs_vals[h];
67547                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
67548                 CHECK_ACCESS(outputs_conv_7_ptr);
67549                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
67550                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
67551                 outputs_constr.data[h] = outputs_conv_7_conv;
67552         }
67553         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
67554         LDKCVec_u8Z change_destination_script_ref;
67555         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
67556         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
67557         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
67558         void* locktime_ptr = untag_ptr(locktime);
67559         CHECK_ACCESS(locktime_ptr);
67560         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
67561         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
67562         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
67563         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
67564         return tag_ptr(ret_conv, true);
67565 }
67566
67567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
67568         LDKKeysManager this_arg_conv;
67569         this_arg_conv.inner = untag_ptr(this_arg);
67570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67572         this_arg_conv.is_owned = false;
67573         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
67574         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
67575         return tag_ptr(ret_ret, true);
67576 }
67577
67578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67579         LDKKeysManager this_arg_conv;
67580         this_arg_conv.inner = untag_ptr(this_arg);
67581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67583         this_arg_conv.is_owned = false;
67584         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
67585         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
67586         return tag_ptr(ret_ret, true);
67587 }
67588
67589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
67590         LDKKeysManager this_arg_conv;
67591         this_arg_conv.inner = untag_ptr(this_arg);
67592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67594         this_arg_conv.is_owned = false;
67595         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
67596         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
67597         return tag_ptr(ret_ret, true);
67598 }
67599
67600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67601         LDKPhantomKeysManager this_obj_conv;
67602         this_obj_conv.inner = untag_ptr(this_obj);
67603         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67605         PhantomKeysManager_free(this_obj_conv);
67606 }
67607
67608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
67609         LDKPhantomKeysManager this_arg_conv;
67610         this_arg_conv.inner = untag_ptr(this_arg);
67611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67613         this_arg_conv.is_owned = false;
67614         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
67615         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
67616         return tag_ptr(ret_ret, true);
67617 }
67618
67619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
67620         LDKPhantomKeysManager this_arg_conv;
67621         this_arg_conv.inner = untag_ptr(this_arg);
67622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67624         this_arg_conv.is_owned = false;
67625         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
67626         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
67627         return tag_ptr(ret_ret, true);
67628 }
67629
67630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
67631         LDKPhantomKeysManager this_arg_conv;
67632         this_arg_conv.inner = untag_ptr(this_arg);
67633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67635         this_arg_conv.is_owned = false;
67636         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
67637         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
67638         return tag_ptr(ret_ret, true);
67639 }
67640
67641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
67642         uint8_t seed_arr[32];
67643         CHECK((*env)->GetArrayLength(env, seed) == 32);
67644         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
67645         uint8_t (*seed_ref)[32] = &seed_arr;
67646         uint8_t cross_node_seed_arr[32];
67647         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
67648         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
67649         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
67650         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
67651         int64_t ret_ref = 0;
67652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67654         return ret_ref;
67655 }
67656
67657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
67658         LDKPhantomKeysManager this_arg_conv;
67659         this_arg_conv.inner = untag_ptr(this_arg);
67660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67662         this_arg_conv.is_owned = false;
67663         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
67664         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
67665         if (descriptors_constr.datalen > 0)
67666                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
67667         else
67668                 descriptors_constr.data = NULL;
67669         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
67670         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
67671                 int64_t descriptors_conv_27 = descriptors_vals[b];
67672                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
67673                 CHECK_ACCESS(descriptors_conv_27_ptr);
67674                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
67675                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
67676                 descriptors_constr.data[b] = descriptors_conv_27_conv;
67677         }
67678         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
67679         LDKCVec_TxOutZ outputs_constr;
67680         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
67681         if (outputs_constr.datalen > 0)
67682                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
67683         else
67684                 outputs_constr.data = NULL;
67685         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
67686         for (size_t h = 0; h < outputs_constr.datalen; h++) {
67687                 int64_t outputs_conv_7 = outputs_vals[h];
67688                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
67689                 CHECK_ACCESS(outputs_conv_7_ptr);
67690                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
67691                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
67692                 outputs_constr.data[h] = outputs_conv_7_conv;
67693         }
67694         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
67695         LDKCVec_u8Z change_destination_script_ref;
67696         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
67697         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
67698         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
67699         void* locktime_ptr = untag_ptr(locktime);
67700         CHECK_ACCESS(locktime_ptr);
67701         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
67702         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
67703         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
67704         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
67705         return tag_ptr(ret_conv, true);
67706 }
67707
67708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
67709         LDKPhantomKeysManager this_arg_conv;
67710         this_arg_conv.inner = untag_ptr(this_arg);
67711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67713         this_arg_conv.is_owned = false;
67714         uint8_t params_arr[32];
67715         CHECK((*env)->GetArrayLength(env, params) == 32);
67716         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
67717         uint8_t (*params_ref)[32] = &params_arr;
67718         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
67719         int64_t ret_ref = 0;
67720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67722         return ret_ref;
67723 }
67724
67725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
67726         LDKPhantomKeysManager this_arg_conv;
67727         this_arg_conv.inner = untag_ptr(this_arg);
67728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67730         this_arg_conv.is_owned = false;
67731         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67732         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
67733         return ret_arr;
67734 }
67735
67736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
67737         LDKPhantomKeysManager this_arg_conv;
67738         this_arg_conv.inner = untag_ptr(this_arg);
67739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67741         this_arg_conv.is_owned = false;
67742         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67743         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
67744         return ret_arr;
67745 }
67746
67747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67748         LDKOnionMessenger this_obj_conv;
67749         this_obj_conv.inner = untag_ptr(this_obj);
67750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67752         OnionMessenger_free(this_obj_conv);
67753 }
67754
67755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67756         if (!ptr_is_owned(this_ptr)) return;
67757         void* this_ptr_ptr = untag_ptr(this_ptr);
67758         CHECK_ACCESS(this_ptr_ptr);
67759         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
67760         FREE(untag_ptr(this_ptr));
67761         MessageRouter_free(this_ptr_conv);
67762 }
67763
67764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67765         LDKDefaultMessageRouter this_obj_conv;
67766         this_obj_conv.inner = untag_ptr(this_obj);
67767         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67769         DefaultMessageRouter_free(this_obj_conv);
67770 }
67771
67772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz) {
67773         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
67774         int64_t ret_ref = 0;
67775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67777         return ret_ref;
67778 }
67779
67780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
67781         LDKDefaultMessageRouter this_arg_conv;
67782         this_arg_conv.inner = untag_ptr(this_arg);
67783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67785         this_arg_conv.is_owned = false;
67786         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
67787         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
67788         return tag_ptr(ret_ret, true);
67789 }
67790
67791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67792         LDKOnionMessagePath this_obj_conv;
67793         this_obj_conv.inner = untag_ptr(this_obj);
67794         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67796         OnionMessagePath_free(this_obj_conv);
67797 }
67798
67799 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
67800         LDKOnionMessagePath this_ptr_conv;
67801         this_ptr_conv.inner = untag_ptr(this_ptr);
67802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67804         this_ptr_conv.is_owned = false;
67805         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
67806         jobjectArray ret_arr = NULL;
67807         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
67808         ;
67809         for (size_t i = 0; i < ret_var.datalen; i++) {
67810                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
67811                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
67812                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
67813         }
67814         
67815         FREE(ret_var.data);
67816         return ret_arr;
67817 }
67818
67819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
67820         LDKOnionMessagePath this_ptr_conv;
67821         this_ptr_conv.inner = untag_ptr(this_ptr);
67822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67824         this_ptr_conv.is_owned = false;
67825         LDKCVec_PublicKeyZ val_constr;
67826         val_constr.datalen = (*env)->GetArrayLength(env, val);
67827         if (val_constr.datalen > 0)
67828                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
67829         else
67830                 val_constr.data = NULL;
67831         for (size_t i = 0; i < val_constr.datalen; i++) {
67832                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
67833                 LDKPublicKey val_conv_8_ref;
67834                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
67835                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
67836                 val_constr.data[i] = val_conv_8_ref;
67837         }
67838         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
67839 }
67840
67841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
67842         LDKOnionMessagePath this_ptr_conv;
67843         this_ptr_conv.inner = untag_ptr(this_ptr);
67844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67846         this_ptr_conv.is_owned = false;
67847         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67848         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
67849         int64_t ret_ref = tag_ptr(ret_copy, true);
67850         return ret_ref;
67851 }
67852
67853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67854         LDKOnionMessagePath this_ptr_conv;
67855         this_ptr_conv.inner = untag_ptr(this_ptr);
67856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67858         this_ptr_conv.is_owned = false;
67859         void* val_ptr = untag_ptr(val);
67860         CHECK_ACCESS(val_ptr);
67861         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
67862         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
67863         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
67864 }
67865
67866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1new(JNIEnv *env, jclass clz, jobjectArray intermediate_nodes_arg, int64_t destination_arg) {
67867         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
67868         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
67869         if (intermediate_nodes_arg_constr.datalen > 0)
67870                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
67871         else
67872                 intermediate_nodes_arg_constr.data = NULL;
67873         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
67874                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
67875                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
67876                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
67877                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
67878                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
67879         }
67880         void* destination_arg_ptr = untag_ptr(destination_arg);
67881         CHECK_ACCESS(destination_arg_ptr);
67882         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
67883         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
67884         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
67885         int64_t ret_ref = 0;
67886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67888         return ret_ref;
67889 }
67890
67891 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
67892         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
67893         int64_t ret_ref = 0;
67894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67896         return ret_ref;
67897 }
67898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67899         LDKOnionMessagePath arg_conv;
67900         arg_conv.inner = untag_ptr(arg);
67901         arg_conv.is_owned = ptr_is_owned(arg);
67902         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67903         arg_conv.is_owned = false;
67904         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
67905         return ret_conv;
67906 }
67907
67908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67909         LDKOnionMessagePath orig_conv;
67910         orig_conv.inner = untag_ptr(orig);
67911         orig_conv.is_owned = ptr_is_owned(orig);
67912         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67913         orig_conv.is_owned = false;
67914         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
67915         int64_t ret_ref = 0;
67916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67918         return ret_ref;
67919 }
67920
67921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67922         if (!ptr_is_owned(this_ptr)) return;
67923         void* this_ptr_ptr = untag_ptr(this_ptr);
67924         CHECK_ACCESS(this_ptr_ptr);
67925         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
67926         FREE(untag_ptr(this_ptr));
67927         Destination_free(this_ptr_conv);
67928 }
67929
67930 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
67931         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67932         *ret_copy = Destination_clone(arg);
67933         int64_t ret_ref = tag_ptr(ret_copy, true);
67934         return ret_ref;
67935 }
67936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67937         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
67938         int64_t ret_conv = Destination_clone_ptr(arg_conv);
67939         return ret_conv;
67940 }
67941
67942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67943         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
67944         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67945         *ret_copy = Destination_clone(orig_conv);
67946         int64_t ret_ref = tag_ptr(ret_copy, true);
67947         return ret_ref;
67948 }
67949
67950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
67951         LDKPublicKey a_ref;
67952         CHECK((*env)->GetArrayLength(env, a) == 33);
67953         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
67954         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67955         *ret_copy = Destination_node(a_ref);
67956         int64_t ret_ref = tag_ptr(ret_copy, true);
67957         return ret_ref;
67958 }
67959
67960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
67961         LDKBlindedPath a_conv;
67962         a_conv.inner = untag_ptr(a);
67963         a_conv.is_owned = ptr_is_owned(a);
67964         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67965         a_conv = BlindedPath_clone(&a_conv);
67966         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
67967         *ret_copy = Destination_blinded_path(a_conv);
67968         int64_t ret_ref = tag_ptr(ret_copy, true);
67969         return ret_ref;
67970 }
67971
67972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67973         if (!ptr_is_owned(this_ptr)) return;
67974         void* this_ptr_ptr = untag_ptr(this_ptr);
67975         CHECK_ACCESS(this_ptr_ptr);
67976         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
67977         FREE(untag_ptr(this_ptr));
67978         SendError_free(this_ptr_conv);
67979 }
67980
67981 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
67982         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
67983         *ret_copy = SendError_clone(arg);
67984         int64_t ret_ref = tag_ptr(ret_copy, true);
67985         return ret_ref;
67986 }
67987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67988         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
67989         int64_t ret_conv = SendError_clone_ptr(arg_conv);
67990         return ret_conv;
67991 }
67992
67993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67994         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
67995         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
67996         *ret_copy = SendError_clone(orig_conv);
67997         int64_t ret_ref = tag_ptr(ret_copy, true);
67998         return ret_ref;
67999 }
68000
68001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
68002         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
68003         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68004         *ret_copy = SendError_secp256k1(a_conv);
68005         int64_t ret_ref = tag_ptr(ret_copy, true);
68006         return ret_ref;
68007 }
68008
68009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
68010         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68011         *ret_copy = SendError_too_big_packet();
68012         int64_t ret_ref = tag_ptr(ret_copy, true);
68013         return ret_ref;
68014 }
68015
68016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
68017         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68018         *ret_copy = SendError_too_few_blinded_hops();
68019         int64_t ret_ref = tag_ptr(ret_copy, true);
68020         return ret_ref;
68021 }
68022
68023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz) {
68024         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68025         *ret_copy = SendError_invalid_first_hop();
68026         int64_t ret_ref = tag_ptr(ret_copy, true);
68027         return ret_ref;
68028 }
68029
68030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
68031         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68032         *ret_copy = SendError_invalid_message();
68033         int64_t ret_ref = tag_ptr(ret_copy, true);
68034         return ret_ref;
68035 }
68036
68037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
68038         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68039         *ret_copy = SendError_buffer_full();
68040         int64_t ret_ref = tag_ptr(ret_copy, true);
68041         return ret_ref;
68042 }
68043
68044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
68045         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68046         *ret_copy = SendError_get_node_id_failed();
68047         int64_t ret_ref = tag_ptr(ret_copy, true);
68048         return ret_ref;
68049 }
68050
68051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
68052         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
68053         *ret_copy = SendError_blinded_path_advance_failed();
68054         int64_t ret_ref = tag_ptr(ret_copy, true);
68055         return ret_ref;
68056 }
68057
68058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68059         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
68060         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
68061         jboolean ret_conv = SendError_eq(a_conv, b_conv);
68062         return ret_conv;
68063 }
68064
68065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68066         if (!ptr_is_owned(this_ptr)) return;
68067         void* this_ptr_ptr = untag_ptr(this_ptr);
68068         CHECK_ACCESS(this_ptr_ptr);
68069         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
68070         FREE(untag_ptr(this_ptr));
68071         CustomOnionMessageHandler_free(this_ptr_conv);
68072 }
68073
68074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t path, int64_t message, int64_t reply_path) {
68075         void* entropy_source_ptr = untag_ptr(entropy_source);
68076         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
68077         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
68078         void* node_signer_ptr = untag_ptr(node_signer);
68079         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
68080         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
68081         LDKOnionMessagePath path_conv;
68082         path_conv.inner = untag_ptr(path);
68083         path_conv.is_owned = ptr_is_owned(path);
68084         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
68085         path_conv = OnionMessagePath_clone(&path_conv);
68086         void* message_ptr = untag_ptr(message);
68087         CHECK_ACCESS(message_ptr);
68088         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
68089         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
68090         LDKBlindedPath reply_path_conv;
68091         reply_path_conv.inner = untag_ptr(reply_path);
68092         reply_path_conv.is_owned = ptr_is_owned(reply_path);
68093         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
68094         reply_path_conv = BlindedPath_clone(&reply_path_conv);
68095         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
68096         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, message_conv, reply_path_conv);
68097         return tag_ptr(ret_conv, true);
68098 }
68099
68100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
68101         void* entropy_source_ptr = untag_ptr(entropy_source);
68102         CHECK_ACCESS(entropy_source_ptr);
68103         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
68104         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
68105                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68106                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
68107         }
68108         void* node_signer_ptr = untag_ptr(node_signer);
68109         CHECK_ACCESS(node_signer_ptr);
68110         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
68111         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
68112                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68113                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
68114         }
68115         void* logger_ptr = untag_ptr(logger);
68116         CHECK_ACCESS(logger_ptr);
68117         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
68118         if (logger_conv.free == LDKLogger_JCalls_free) {
68119                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68120                 LDKLogger_JCalls_cloned(&logger_conv);
68121         }
68122         void* message_router_ptr = untag_ptr(message_router);
68123         CHECK_ACCESS(message_router_ptr);
68124         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
68125         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
68126                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68127                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
68128         }
68129         void* offers_handler_ptr = untag_ptr(offers_handler);
68130         CHECK_ACCESS(offers_handler_ptr);
68131         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
68132         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
68133                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68134                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
68135         }
68136         void* custom_handler_ptr = untag_ptr(custom_handler);
68137         CHECK_ACCESS(custom_handler_ptr);
68138         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
68139         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
68140                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68141                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
68142         }
68143         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
68144         int64_t ret_ref = 0;
68145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68147         return ret_ref;
68148 }
68149
68150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t message, int64_t reply_path) {
68151         LDKOnionMessenger this_arg_conv;
68152         this_arg_conv.inner = untag_ptr(this_arg);
68153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68155         this_arg_conv.is_owned = false;
68156         LDKOnionMessagePath path_conv;
68157         path_conv.inner = untag_ptr(path);
68158         path_conv.is_owned = ptr_is_owned(path);
68159         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
68160         path_conv = OnionMessagePath_clone(&path_conv);
68161         void* message_ptr = untag_ptr(message);
68162         CHECK_ACCESS(message_ptr);
68163         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
68164         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
68165         LDKBlindedPath reply_path_conv;
68166         reply_path_conv.inner = untag_ptr(reply_path);
68167         reply_path_conv.is_owned = ptr_is_owned(reply_path);
68168         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
68169         reply_path_conv = BlindedPath_clone(&reply_path_conv);
68170         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
68171         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, message_conv, reply_path_conv);
68172         return tag_ptr(ret_conv, true);
68173 }
68174
68175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
68176         LDKOnionMessenger this_arg_conv;
68177         this_arg_conv.inner = untag_ptr(this_arg);
68178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68180         this_arg_conv.is_owned = false;
68181         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
68182         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
68183         return tag_ptr(ret_ret, true);
68184 }
68185
68186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
68187         LDKOnionMessenger this_arg_conv;
68188         this_arg_conv.inner = untag_ptr(this_arg);
68189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68191         this_arg_conv.is_owned = false;
68192         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
68193         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
68194         return tag_ptr(ret_ret, true);
68195 }
68196
68197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68198         if (!ptr_is_owned(this_ptr)) return;
68199         void* this_ptr_ptr = untag_ptr(this_ptr);
68200         CHECK_ACCESS(this_ptr_ptr);
68201         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
68202         FREE(untag_ptr(this_ptr));
68203         OffersMessageHandler_free(this_ptr_conv);
68204 }
68205
68206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68207         if (!ptr_is_owned(this_ptr)) return;
68208         void* this_ptr_ptr = untag_ptr(this_ptr);
68209         CHECK_ACCESS(this_ptr_ptr);
68210         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
68211         FREE(untag_ptr(this_ptr));
68212         OffersMessage_free(this_ptr_conv);
68213 }
68214
68215 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
68216         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68217         *ret_copy = OffersMessage_clone(arg);
68218         int64_t ret_ref = tag_ptr(ret_copy, true);
68219         return ret_ref;
68220 }
68221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68222         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
68223         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
68224         return ret_conv;
68225 }
68226
68227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68228         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
68229         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68230         *ret_copy = OffersMessage_clone(orig_conv);
68231         int64_t ret_ref = tag_ptr(ret_copy, true);
68232         return ret_ref;
68233 }
68234
68235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
68236         LDKInvoiceRequest a_conv;
68237         a_conv.inner = untag_ptr(a);
68238         a_conv.is_owned = ptr_is_owned(a);
68239         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68240         a_conv = InvoiceRequest_clone(&a_conv);
68241         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68242         *ret_copy = OffersMessage_invoice_request(a_conv);
68243         int64_t ret_ref = tag_ptr(ret_copy, true);
68244         return ret_ref;
68245 }
68246
68247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
68248         LDKBolt12Invoice a_conv;
68249         a_conv.inner = untag_ptr(a);
68250         a_conv.is_owned = ptr_is_owned(a);
68251         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68252         a_conv = Bolt12Invoice_clone(&a_conv);
68253         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68254         *ret_copy = OffersMessage_invoice(a_conv);
68255         int64_t ret_ref = tag_ptr(ret_copy, true);
68256         return ret_ref;
68257 }
68258
68259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
68260         LDKInvoiceError a_conv;
68261         a_conv.inner = untag_ptr(a);
68262         a_conv.is_owned = ptr_is_owned(a);
68263         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68264         a_conv = InvoiceError_clone(&a_conv);
68265         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
68266         *ret_copy = OffersMessage_invoice_error(a_conv);
68267         int64_t ret_ref = tag_ptr(ret_copy, true);
68268         return ret_ref;
68269 }
68270
68271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
68272         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
68273         return ret_conv;
68274 }
68275
68276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
68277         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
68278         int64_t ret_conv = OffersMessage_tlv_type(this_arg_conv);
68279         return ret_conv;
68280 }
68281
68282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
68283         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
68284         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
68285         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68286         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68287         CVec_u8Z_free(ret_var);
68288         return ret_arr;
68289 }
68290
68291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) {
68292         LDKu8slice ser_ref;
68293         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68294         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68295         void* arg_b_ptr = untag_ptr(arg_b);
68296         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
68297         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
68298         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
68299         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
68300         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68301         return tag_ptr(ret_conv, true);
68302 }
68303
68304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68305         LDKPacket this_obj_conv;
68306         this_obj_conv.inner = untag_ptr(this_obj);
68307         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68309         Packet_free(this_obj_conv);
68310 }
68311
68312 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Packet_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
68313         LDKPacket this_ptr_conv;
68314         this_ptr_conv.inner = untag_ptr(this_ptr);
68315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68317         this_ptr_conv.is_owned = false;
68318         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
68319         return ret_conv;
68320 }
68321
68322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
68323         LDKPacket this_ptr_conv;
68324         this_ptr_conv.inner = untag_ptr(this_ptr);
68325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68327         this_ptr_conv.is_owned = false;
68328         Packet_set_version(&this_ptr_conv, val);
68329 }
68330
68331 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68332         LDKPacket this_ptr_conv;
68333         this_ptr_conv.inner = untag_ptr(this_ptr);
68334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68336         this_ptr_conv.is_owned = false;
68337         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68338         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Packet_get_public_key(&this_ptr_conv).compressed_form);
68339         return ret_arr;
68340 }
68341
68342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68343         LDKPacket this_ptr_conv;
68344         this_ptr_conv.inner = untag_ptr(this_ptr);
68345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68347         this_ptr_conv.is_owned = false;
68348         LDKPublicKey val_ref;
68349         CHECK((*env)->GetArrayLength(env, val) == 33);
68350         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
68351         Packet_set_public_key(&this_ptr_conv, val_ref);
68352 }
68353
68354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
68355         LDKPacket this_ptr_conv;
68356         this_ptr_conv.inner = untag_ptr(this_ptr);
68357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68359         this_ptr_conv.is_owned = false;
68360         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
68361         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68362         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68363         CVec_u8Z_free(ret_var);
68364         return ret_arr;
68365 }
68366
68367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68368         LDKPacket this_ptr_conv;
68369         this_ptr_conv.inner = untag_ptr(this_ptr);
68370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68372         this_ptr_conv.is_owned = false;
68373         LDKCVec_u8Z val_ref;
68374         val_ref.datalen = (*env)->GetArrayLength(env, val);
68375         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
68376         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
68377         Packet_set_hop_data(&this_ptr_conv, val_ref);
68378 }
68379
68380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
68381         LDKPacket this_ptr_conv;
68382         this_ptr_conv.inner = untag_ptr(this_ptr);
68383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68385         this_ptr_conv.is_owned = false;
68386         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68387         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Packet_get_hmac(&this_ptr_conv));
68388         return ret_arr;
68389 }
68390
68391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68392         LDKPacket this_ptr_conv;
68393         this_ptr_conv.inner = untag_ptr(this_ptr);
68394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68396         this_ptr_conv.is_owned = false;
68397         LDKThirtyTwoBytes val_ref;
68398         CHECK((*env)->GetArrayLength(env, val) == 32);
68399         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
68400         Packet_set_hmac(&this_ptr_conv, val_ref);
68401 }
68402
68403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1new(JNIEnv *env, jclass clz, int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
68404         LDKPublicKey public_key_arg_ref;
68405         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
68406         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
68407         LDKCVec_u8Z hop_data_arg_ref;
68408         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
68409         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
68410         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
68411         LDKThirtyTwoBytes hmac_arg_ref;
68412         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
68413         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
68414         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
68415         int64_t ret_ref = 0;
68416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68418         return ret_ref;
68419 }
68420
68421 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
68422         LDKPacket ret_var = Packet_clone(arg);
68423         int64_t ret_ref = 0;
68424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68426         return ret_ref;
68427 }
68428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68429         LDKPacket arg_conv;
68430         arg_conv.inner = untag_ptr(arg);
68431         arg_conv.is_owned = ptr_is_owned(arg);
68432         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68433         arg_conv.is_owned = false;
68434         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
68435         return ret_conv;
68436 }
68437
68438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68439         LDKPacket orig_conv;
68440         orig_conv.inner = untag_ptr(orig);
68441         orig_conv.is_owned = ptr_is_owned(orig);
68442         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68443         orig_conv.is_owned = false;
68444         LDKPacket ret_var = Packet_clone(&orig_conv);
68445         int64_t ret_ref = 0;
68446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68448         return ret_ref;
68449 }
68450
68451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Packet_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68452         LDKPacket a_conv;
68453         a_conv.inner = untag_ptr(a);
68454         a_conv.is_owned = ptr_is_owned(a);
68455         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68456         a_conv.is_owned = false;
68457         LDKPacket b_conv;
68458         b_conv.inner = untag_ptr(b);
68459         b_conv.is_owned = ptr_is_owned(b);
68460         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68461         b_conv.is_owned = false;
68462         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
68463         return ret_conv;
68464 }
68465
68466 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *env, jclass clz, int64_t obj) {
68467         LDKPacket obj_conv;
68468         obj_conv.inner = untag_ptr(obj);
68469         obj_conv.is_owned = ptr_is_owned(obj);
68470         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68471         obj_conv.is_owned = false;
68472         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
68473         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68474         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68475         CVec_u8Z_free(ret_var);
68476         return ret_arr;
68477 }
68478
68479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68480         if (!ptr_is_owned(this_ptr)) return;
68481         void* this_ptr_ptr = untag_ptr(this_ptr);
68482         CHECK_ACCESS(this_ptr_ptr);
68483         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
68484         FREE(untag_ptr(this_ptr));
68485         OnionMessageContents_free(this_ptr_conv);
68486 }
68487
68488 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
68489         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
68490         *ret_copy = OnionMessageContents_clone(arg);
68491         int64_t ret_ref = tag_ptr(ret_copy, true);
68492         return ret_ref;
68493 }
68494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68495         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
68496         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
68497         return ret_conv;
68498 }
68499
68500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68501         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
68502         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
68503         *ret_copy = OnionMessageContents_clone(orig_conv);
68504         int64_t ret_ref = tag_ptr(ret_copy, true);
68505         return ret_ref;
68506 }
68507
68508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
68509         void* a_ptr = untag_ptr(a);
68510         CHECK_ACCESS(a_ptr);
68511         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
68512         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
68513         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
68514         *ret_copy = OnionMessageContents_offers(a_conv);
68515         int64_t ret_ref = tag_ptr(ret_copy, true);
68516         return ret_ref;
68517 }
68518
68519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
68520         void* a_ptr = untag_ptr(a);
68521         CHECK_ACCESS(a_ptr);
68522         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
68523         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
68524                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68525                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
68526         }
68527         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
68528         *ret_copy = OnionMessageContents_custom(a_conv);
68529         int64_t ret_ref = tag_ptr(ret_copy, true);
68530         return ret_ref;
68531 }
68532
68533 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
68534         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
68535         *ret_ret = CustomOnionMessageContents_clone(arg);
68536         return tag_ptr(ret_ret, true);
68537 }
68538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68539         void* arg_ptr = untag_ptr(arg);
68540         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
68541         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
68542         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
68543         return ret_conv;
68544 }
68545
68546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68547         void* orig_ptr = untag_ptr(orig);
68548         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
68549         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
68550         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
68551         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
68552         return tag_ptr(ret_ret, true);
68553 }
68554
68555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68556         if (!ptr_is_owned(this_ptr)) return;
68557         void* this_ptr_ptr = untag_ptr(this_ptr);
68558         CHECK_ACCESS(this_ptr_ptr);
68559         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
68560         FREE(untag_ptr(this_ptr));
68561         CustomOnionMessageContents_free(this_ptr_conv);
68562 }
68563
68564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68565         LDKBlindedPath this_obj_conv;
68566         this_obj_conv.inner = untag_ptr(this_obj);
68567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68569         BlindedPath_free(this_obj_conv);
68570 }
68571
68572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
68573         LDKBlindedPath this_ptr_conv;
68574         this_ptr_conv.inner = untag_ptr(this_ptr);
68575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68577         this_ptr_conv.is_owned = false;
68578         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68579         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form);
68580         return ret_arr;
68581 }
68582
68583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68584         LDKBlindedPath this_ptr_conv;
68585         this_ptr_conv.inner = untag_ptr(this_ptr);
68586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68588         this_ptr_conv.is_owned = false;
68589         LDKPublicKey val_ref;
68590         CHECK((*env)->GetArrayLength(env, val) == 33);
68591         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
68592         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
68593 }
68594
68595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
68596         LDKBlindedPath this_ptr_conv;
68597         this_ptr_conv.inner = untag_ptr(this_ptr);
68598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68600         this_ptr_conv.is_owned = false;
68601         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68602         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form);
68603         return ret_arr;
68604 }
68605
68606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68607         LDKBlindedPath this_ptr_conv;
68608         this_ptr_conv.inner = untag_ptr(this_ptr);
68609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68611         this_ptr_conv.is_owned = false;
68612         LDKPublicKey val_ref;
68613         CHECK((*env)->GetArrayLength(env, val) == 33);
68614         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
68615         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
68616 }
68617
68618 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
68619         LDKBlindedPath this_ptr_conv;
68620         this_ptr_conv.inner = untag_ptr(this_ptr);
68621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68623         this_ptr_conv.is_owned = false;
68624         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
68625         int64_tArray ret_arr = NULL;
68626         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68627         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68628         for (size_t m = 0; m < ret_var.datalen; m++) {
68629                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
68630                 int64_t ret_conv_12_ref = 0;
68631                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
68632                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
68633                 ret_arr_ptr[m] = ret_conv_12_ref;
68634         }
68635         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68636         FREE(ret_var.data);
68637         return ret_arr;
68638 }
68639
68640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
68641         LDKBlindedPath this_ptr_conv;
68642         this_ptr_conv.inner = untag_ptr(this_ptr);
68643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68645         this_ptr_conv.is_owned = false;
68646         LDKCVec_BlindedHopZ val_constr;
68647         val_constr.datalen = (*env)->GetArrayLength(env, val);
68648         if (val_constr.datalen > 0)
68649                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
68650         else
68651                 val_constr.data = NULL;
68652         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
68653         for (size_t m = 0; m < val_constr.datalen; m++) {
68654                 int64_t val_conv_12 = val_vals[m];
68655                 LDKBlindedHop val_conv_12_conv;
68656                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
68657                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
68658                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
68659                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
68660                 val_constr.data[m] = val_conv_12_conv;
68661         }
68662         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
68663         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
68664 }
68665
68666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, int8_tArray introduction_node_id_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
68667         LDKPublicKey introduction_node_id_arg_ref;
68668         CHECK((*env)->GetArrayLength(env, introduction_node_id_arg) == 33);
68669         (*env)->GetByteArrayRegion(env, introduction_node_id_arg, 0, 33, introduction_node_id_arg_ref.compressed_form);
68670         LDKPublicKey blinding_point_arg_ref;
68671         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
68672         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
68673         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
68674         blinded_hops_arg_constr.datalen = (*env)->GetArrayLength(env, blinded_hops_arg);
68675         if (blinded_hops_arg_constr.datalen > 0)
68676                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
68677         else
68678                 blinded_hops_arg_constr.data = NULL;
68679         int64_t* blinded_hops_arg_vals = (*env)->GetLongArrayElements (env, blinded_hops_arg, NULL);
68680         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
68681                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
68682                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
68683                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
68684                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
68685                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
68686                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
68687                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
68688         }
68689         (*env)->ReleaseLongArrayElements(env, blinded_hops_arg, blinded_hops_arg_vals, 0);
68690         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
68691         int64_t ret_ref = 0;
68692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68694         return ret_ref;
68695 }
68696
68697 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
68698         LDKBlindedPath ret_var = BlindedPath_clone(arg);
68699         int64_t ret_ref = 0;
68700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68702         return ret_ref;
68703 }
68704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68705         LDKBlindedPath arg_conv;
68706         arg_conv.inner = untag_ptr(arg);
68707         arg_conv.is_owned = ptr_is_owned(arg);
68708         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68709         arg_conv.is_owned = false;
68710         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
68711         return ret_conv;
68712 }
68713
68714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68715         LDKBlindedPath orig_conv;
68716         orig_conv.inner = untag_ptr(orig);
68717         orig_conv.is_owned = ptr_is_owned(orig);
68718         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68719         orig_conv.is_owned = false;
68720         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
68721         int64_t ret_ref = 0;
68722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68724         return ret_ref;
68725 }
68726
68727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
68728         LDKBlindedPath o_conv;
68729         o_conv.inner = untag_ptr(o);
68730         o_conv.is_owned = ptr_is_owned(o);
68731         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68732         o_conv.is_owned = false;
68733         int64_t ret_conv = BlindedPath_hash(&o_conv);
68734         return ret_conv;
68735 }
68736
68737 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68738         LDKBlindedPath a_conv;
68739         a_conv.inner = untag_ptr(a);
68740         a_conv.is_owned = ptr_is_owned(a);
68741         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68742         a_conv.is_owned = false;
68743         LDKBlindedPath b_conv;
68744         b_conv.inner = untag_ptr(b);
68745         b_conv.is_owned = ptr_is_owned(b);
68746         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68747         b_conv.is_owned = false;
68748         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
68749         return ret_conv;
68750 }
68751
68752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68753         LDKBlindedHop this_obj_conv;
68754         this_obj_conv.inner = untag_ptr(this_obj);
68755         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68757         BlindedHop_free(this_obj_conv);
68758 }
68759
68760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
68761         LDKBlindedHop this_ptr_conv;
68762         this_ptr_conv.inner = untag_ptr(this_ptr);
68763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68765         this_ptr_conv.is_owned = false;
68766         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68767         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form);
68768         return ret_arr;
68769 }
68770
68771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68772         LDKBlindedHop this_ptr_conv;
68773         this_ptr_conv.inner = untag_ptr(this_ptr);
68774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68776         this_ptr_conv.is_owned = false;
68777         LDKPublicKey val_ref;
68778         CHECK((*env)->GetArrayLength(env, val) == 33);
68779         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
68780         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
68781 }
68782
68783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr) {
68784         LDKBlindedHop this_ptr_conv;
68785         this_ptr_conv.inner = untag_ptr(this_ptr);
68786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68788         this_ptr_conv.is_owned = false;
68789         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
68790         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68791         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68792         CVec_u8Z_free(ret_var);
68793         return ret_arr;
68794 }
68795
68796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68797         LDKBlindedHop this_ptr_conv;
68798         this_ptr_conv.inner = untag_ptr(this_ptr);
68799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68801         this_ptr_conv.is_owned = false;
68802         LDKCVec_u8Z val_ref;
68803         val_ref.datalen = (*env)->GetArrayLength(env, val);
68804         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
68805         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
68806         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
68807 }
68808
68809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1new(JNIEnv *env, jclass clz, int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
68810         LDKPublicKey blinded_node_id_arg_ref;
68811         CHECK((*env)->GetArrayLength(env, blinded_node_id_arg) == 33);
68812         (*env)->GetByteArrayRegion(env, blinded_node_id_arg, 0, 33, blinded_node_id_arg_ref.compressed_form);
68813         LDKCVec_u8Z encrypted_payload_arg_ref;
68814         encrypted_payload_arg_ref.datalen = (*env)->GetArrayLength(env, encrypted_payload_arg);
68815         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
68816         (*env)->GetByteArrayRegion(env, encrypted_payload_arg, 0, encrypted_payload_arg_ref.datalen, encrypted_payload_arg_ref.data);
68817         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
68818         int64_t ret_ref = 0;
68819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68821         return ret_ref;
68822 }
68823
68824 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
68825         LDKBlindedHop ret_var = BlindedHop_clone(arg);
68826         int64_t ret_ref = 0;
68827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68829         return ret_ref;
68830 }
68831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68832         LDKBlindedHop arg_conv;
68833         arg_conv.inner = untag_ptr(arg);
68834         arg_conv.is_owned = ptr_is_owned(arg);
68835         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68836         arg_conv.is_owned = false;
68837         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
68838         return ret_conv;
68839 }
68840
68841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68842         LDKBlindedHop orig_conv;
68843         orig_conv.inner = untag_ptr(orig);
68844         orig_conv.is_owned = ptr_is_owned(orig);
68845         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68846         orig_conv.is_owned = false;
68847         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
68848         int64_t ret_ref = 0;
68849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68851         return ret_ref;
68852 }
68853
68854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
68855         LDKBlindedHop o_conv;
68856         o_conv.inner = untag_ptr(o);
68857         o_conv.is_owned = ptr_is_owned(o);
68858         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68859         o_conv.is_owned = false;
68860         int64_t ret_conv = BlindedHop_hash(&o_conv);
68861         return ret_conv;
68862 }
68863
68864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68865         LDKBlindedHop a_conv;
68866         a_conv.inner = untag_ptr(a);
68867         a_conv.is_owned = ptr_is_owned(a);
68868         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68869         a_conv.is_owned = false;
68870         LDKBlindedHop b_conv;
68871         b_conv.inner = untag_ptr(b);
68872         b_conv.is_owned = ptr_is_owned(b);
68873         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68874         b_conv.is_owned = false;
68875         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
68876         return ret_conv;
68877 }
68878
68879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
68880         LDKCVec_PublicKeyZ node_pks_constr;
68881         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
68882         if (node_pks_constr.datalen > 0)
68883                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
68884         else
68885                 node_pks_constr.data = NULL;
68886         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
68887                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
68888                 LDKPublicKey node_pks_conv_8_ref;
68889                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
68890                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
68891                 node_pks_constr.data[i] = node_pks_conv_8_ref;
68892         }
68893         void* entropy_source_ptr = untag_ptr(entropy_source);
68894         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
68895         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
68896         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
68897         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
68898         return tag_ptr(ret_conv, true);
68899 }
68900
68901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1payment(JNIEnv *env, jclass clz, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t entropy_source) {
68902         LDKPublicKey payee_node_id_ref;
68903         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
68904         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
68905         LDKReceiveTlvs payee_tlvs_conv;
68906         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
68907         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
68908         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
68909         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
68910         void* entropy_source_ptr = untag_ptr(entropy_source);
68911         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
68912         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
68913         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
68914         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
68915         return tag_ptr(ret_conv, true);
68916 }
68917
68918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
68919         LDKBlindedPath obj_conv;
68920         obj_conv.inner = untag_ptr(obj);
68921         obj_conv.is_owned = ptr_is_owned(obj);
68922         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68923         obj_conv.is_owned = false;
68924         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
68925         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68926         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68927         CVec_u8Z_free(ret_var);
68928         return ret_arr;
68929 }
68930
68931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68932         LDKu8slice ser_ref;
68933         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68934         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68935         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
68936         *ret_conv = BlindedPath_read(ser_ref);
68937         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68938         return tag_ptr(ret_conv, true);
68939 }
68940
68941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
68942         LDKBlindedHop obj_conv;
68943         obj_conv.inner = untag_ptr(obj);
68944         obj_conv.is_owned = ptr_is_owned(obj);
68945         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68946         obj_conv.is_owned = false;
68947         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
68948         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68949         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68950         CVec_u8Z_free(ret_var);
68951         return ret_arr;
68952 }
68953
68954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68955         LDKu8slice ser_ref;
68956         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68957         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68958         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
68959         *ret_conv = BlindedHop_read(ser_ref);
68960         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68961         return tag_ptr(ret_conv, true);
68962 }
68963
68964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68965         LDKForwardNode this_obj_conv;
68966         this_obj_conv.inner = untag_ptr(this_obj);
68967         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68969         ForwardNode_free(this_obj_conv);
68970 }
68971
68972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr) {
68973         LDKForwardNode this_ptr_conv;
68974         this_ptr_conv.inner = untag_ptr(this_ptr);
68975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68977         this_ptr_conv.is_owned = false;
68978         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
68979         int64_t ret_ref = 0;
68980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68982         return ret_ref;
68983 }
68984
68985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68986         LDKForwardNode this_ptr_conv;
68987         this_ptr_conv.inner = untag_ptr(this_ptr);
68988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68990         this_ptr_conv.is_owned = false;
68991         LDKForwardTlvs val_conv;
68992         val_conv.inner = untag_ptr(val);
68993         val_conv.is_owned = ptr_is_owned(val);
68994         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68995         val_conv = ForwardTlvs_clone(&val_conv);
68996         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
68997 }
68998
68999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69000         LDKForwardNode this_ptr_conv;
69001         this_ptr_conv.inner = untag_ptr(this_ptr);
69002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69004         this_ptr_conv.is_owned = false;
69005         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69006         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ForwardNode_get_node_id(&this_ptr_conv).compressed_form);
69007         return ret_arr;
69008 }
69009
69010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69011         LDKForwardNode this_ptr_conv;
69012         this_ptr_conv.inner = untag_ptr(this_ptr);
69013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69015         this_ptr_conv.is_owned = false;
69016         LDKPublicKey val_ref;
69017         CHECK((*env)->GetArrayLength(env, val) == 33);
69018         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69019         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
69020 }
69021
69022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69023         LDKForwardNode this_ptr_conv;
69024         this_ptr_conv.inner = untag_ptr(this_ptr);
69025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69027         this_ptr_conv.is_owned = false;
69028         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
69029         return ret_conv;
69030 }
69031
69032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69033         LDKForwardNode this_ptr_conv;
69034         this_ptr_conv.inner = untag_ptr(this_ptr);
69035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69037         this_ptr_conv.is_owned = false;
69038         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
69039 }
69040
69041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1new(JNIEnv *env, jclass clz, int64_t tlvs_arg, int8_tArray node_id_arg, int64_t htlc_maximum_msat_arg) {
69042         LDKForwardTlvs tlvs_arg_conv;
69043         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
69044         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
69045         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
69046         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
69047         LDKPublicKey node_id_arg_ref;
69048         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
69049         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
69050         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
69051         int64_t ret_ref = 0;
69052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69054         return ret_ref;
69055 }
69056
69057 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
69058         LDKForwardNode ret_var = ForwardNode_clone(arg);
69059         int64_t ret_ref = 0;
69060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69062         return ret_ref;
69063 }
69064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69065         LDKForwardNode arg_conv;
69066         arg_conv.inner = untag_ptr(arg);
69067         arg_conv.is_owned = ptr_is_owned(arg);
69068         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69069         arg_conv.is_owned = false;
69070         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
69071         return ret_conv;
69072 }
69073
69074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69075         LDKForwardNode orig_conv;
69076         orig_conv.inner = untag_ptr(orig);
69077         orig_conv.is_owned = ptr_is_owned(orig);
69078         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69079         orig_conv.is_owned = false;
69080         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
69081         int64_t ret_ref = 0;
69082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69084         return ret_ref;
69085 }
69086
69087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69088         LDKForwardTlvs this_obj_conv;
69089         this_obj_conv.inner = untag_ptr(this_obj);
69090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69092         ForwardTlvs_free(this_obj_conv);
69093 }
69094
69095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69096         LDKForwardTlvs this_ptr_conv;
69097         this_ptr_conv.inner = untag_ptr(this_ptr);
69098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69100         this_ptr_conv.is_owned = false;
69101         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
69102         return ret_conv;
69103 }
69104
69105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69106         LDKForwardTlvs this_ptr_conv;
69107         this_ptr_conv.inner = untag_ptr(this_ptr);
69108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69110         this_ptr_conv.is_owned = false;
69111         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
69112 }
69113
69114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr) {
69115         LDKForwardTlvs this_ptr_conv;
69116         this_ptr_conv.inner = untag_ptr(this_ptr);
69117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69119         this_ptr_conv.is_owned = false;
69120         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
69121         int64_t ret_ref = 0;
69122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69124         return ret_ref;
69125 }
69126
69127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69128         LDKForwardTlvs this_ptr_conv;
69129         this_ptr_conv.inner = untag_ptr(this_ptr);
69130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69132         this_ptr_conv.is_owned = false;
69133         LDKPaymentRelay val_conv;
69134         val_conv.inner = untag_ptr(val);
69135         val_conv.is_owned = ptr_is_owned(val);
69136         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69137         val_conv = PaymentRelay_clone(&val_conv);
69138         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
69139 }
69140
69141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
69142         LDKForwardTlvs this_ptr_conv;
69143         this_ptr_conv.inner = untag_ptr(this_ptr);
69144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69146         this_ptr_conv.is_owned = false;
69147         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
69148         int64_t ret_ref = 0;
69149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69151         return ret_ref;
69152 }
69153
69154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69155         LDKForwardTlvs this_ptr_conv;
69156         this_ptr_conv.inner = untag_ptr(this_ptr);
69157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69159         this_ptr_conv.is_owned = false;
69160         LDKPaymentConstraints val_conv;
69161         val_conv.inner = untag_ptr(val);
69162         val_conv.is_owned = ptr_is_owned(val);
69163         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69164         val_conv = PaymentConstraints_clone(&val_conv);
69165         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
69166 }
69167
69168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
69169         LDKForwardTlvs this_ptr_conv;
69170         this_ptr_conv.inner = untag_ptr(this_ptr);
69171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69173         this_ptr_conv.is_owned = false;
69174         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
69175         int64_t ret_ref = 0;
69176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69178         return ret_ref;
69179 }
69180
69181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69182         LDKForwardTlvs this_ptr_conv;
69183         this_ptr_conv.inner = untag_ptr(this_ptr);
69184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69186         this_ptr_conv.is_owned = false;
69187         LDKBlindedHopFeatures val_conv;
69188         val_conv.inner = untag_ptr(val);
69189         val_conv.is_owned = ptr_is_owned(val);
69190         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69191         val_conv = BlindedHopFeatures_clone(&val_conv);
69192         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
69193 }
69194
69195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1new(JNIEnv *env, jclass clz, int64_t short_channel_id_arg, int64_t payment_relay_arg, int64_t payment_constraints_arg, int64_t features_arg) {
69196         LDKPaymentRelay payment_relay_arg_conv;
69197         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
69198         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
69199         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
69200         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
69201         LDKPaymentConstraints payment_constraints_arg_conv;
69202         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
69203         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
69204         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
69205         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
69206         LDKBlindedHopFeatures features_arg_conv;
69207         features_arg_conv.inner = untag_ptr(features_arg);
69208         features_arg_conv.is_owned = ptr_is_owned(features_arg);
69209         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
69210         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
69211         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
69212         int64_t ret_ref = 0;
69213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69215         return ret_ref;
69216 }
69217
69218 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
69219         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
69220         int64_t ret_ref = 0;
69221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69223         return ret_ref;
69224 }
69225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69226         LDKForwardTlvs arg_conv;
69227         arg_conv.inner = untag_ptr(arg);
69228         arg_conv.is_owned = ptr_is_owned(arg);
69229         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69230         arg_conv.is_owned = false;
69231         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
69232         return ret_conv;
69233 }
69234
69235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69236         LDKForwardTlvs orig_conv;
69237         orig_conv.inner = untag_ptr(orig);
69238         orig_conv.is_owned = ptr_is_owned(orig);
69239         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69240         orig_conv.is_owned = false;
69241         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
69242         int64_t ret_ref = 0;
69243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69245         return ret_ref;
69246 }
69247
69248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69249         LDKReceiveTlvs this_obj_conv;
69250         this_obj_conv.inner = untag_ptr(this_obj);
69251         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69253         ReceiveTlvs_free(this_obj_conv);
69254 }
69255
69256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
69257         LDKReceiveTlvs this_ptr_conv;
69258         this_ptr_conv.inner = untag_ptr(this_ptr);
69259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69261         this_ptr_conv.is_owned = false;
69262         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
69263         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReceiveTlvs_get_payment_secret(&this_ptr_conv));
69264         return ret_arr;
69265 }
69266
69267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69268         LDKReceiveTlvs this_ptr_conv;
69269         this_ptr_conv.inner = untag_ptr(this_ptr);
69270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69272         this_ptr_conv.is_owned = false;
69273         LDKThirtyTwoBytes val_ref;
69274         CHECK((*env)->GetArrayLength(env, val) == 32);
69275         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
69276         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
69277 }
69278
69279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
69280         LDKReceiveTlvs this_ptr_conv;
69281         this_ptr_conv.inner = untag_ptr(this_ptr);
69282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69284         this_ptr_conv.is_owned = false;
69285         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
69286         int64_t ret_ref = 0;
69287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69289         return ret_ref;
69290 }
69291
69292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69293         LDKReceiveTlvs this_ptr_conv;
69294         this_ptr_conv.inner = untag_ptr(this_ptr);
69295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69297         this_ptr_conv.is_owned = false;
69298         LDKPaymentConstraints val_conv;
69299         val_conv.inner = untag_ptr(val);
69300         val_conv.is_owned = ptr_is_owned(val);
69301         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69302         val_conv = PaymentConstraints_clone(&val_conv);
69303         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
69304 }
69305
69306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1new(JNIEnv *env, jclass clz, int8_tArray payment_secret_arg, int64_t payment_constraints_arg) {
69307         LDKThirtyTwoBytes payment_secret_arg_ref;
69308         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
69309         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
69310         LDKPaymentConstraints payment_constraints_arg_conv;
69311         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
69312         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
69313         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
69314         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
69315         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
69316         int64_t ret_ref = 0;
69317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69319         return ret_ref;
69320 }
69321
69322 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
69323         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
69324         int64_t ret_ref = 0;
69325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69327         return ret_ref;
69328 }
69329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69330         LDKReceiveTlvs arg_conv;
69331         arg_conv.inner = untag_ptr(arg);
69332         arg_conv.is_owned = ptr_is_owned(arg);
69333         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69334         arg_conv.is_owned = false;
69335         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
69336         return ret_conv;
69337 }
69338
69339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69340         LDKReceiveTlvs orig_conv;
69341         orig_conv.inner = untag_ptr(orig);
69342         orig_conv.is_owned = ptr_is_owned(orig);
69343         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69344         orig_conv.is_owned = false;
69345         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
69346         int64_t ret_ref = 0;
69347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69349         return ret_ref;
69350 }
69351
69352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69353         LDKPaymentRelay this_obj_conv;
69354         this_obj_conv.inner = untag_ptr(this_obj);
69355         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69357         PaymentRelay_free(this_obj_conv);
69358 }
69359
69360 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
69361         LDKPaymentRelay this_ptr_conv;
69362         this_ptr_conv.inner = untag_ptr(this_ptr);
69363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69365         this_ptr_conv.is_owned = false;
69366         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
69367         return ret_conv;
69368 }
69369
69370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
69371         LDKPaymentRelay this_ptr_conv;
69372         this_ptr_conv.inner = untag_ptr(this_ptr);
69373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69375         this_ptr_conv.is_owned = false;
69376         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
69377 }
69378
69379 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
69380         LDKPaymentRelay this_ptr_conv;
69381         this_ptr_conv.inner = untag_ptr(this_ptr);
69382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69384         this_ptr_conv.is_owned = false;
69385         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
69386         return ret_conv;
69387 }
69388
69389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69390         LDKPaymentRelay this_ptr_conv;
69391         this_ptr_conv.inner = untag_ptr(this_ptr);
69392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69394         this_ptr_conv.is_owned = false;
69395         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
69396 }
69397
69398 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69399         LDKPaymentRelay this_ptr_conv;
69400         this_ptr_conv.inner = untag_ptr(this_ptr);
69401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69403         this_ptr_conv.is_owned = false;
69404         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
69405         return ret_conv;
69406 }
69407
69408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69409         LDKPaymentRelay this_ptr_conv;
69410         this_ptr_conv.inner = untag_ptr(this_ptr);
69411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69413         this_ptr_conv.is_owned = false;
69414         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
69415 }
69416
69417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1new(JNIEnv *env, jclass clz, int16_t cltv_expiry_delta_arg, int32_t fee_proportional_millionths_arg, int32_t fee_base_msat_arg) {
69418         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
69419         int64_t ret_ref = 0;
69420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69422         return ret_ref;
69423 }
69424
69425 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
69426         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
69427         int64_t ret_ref = 0;
69428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69430         return ret_ref;
69431 }
69432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69433         LDKPaymentRelay arg_conv;
69434         arg_conv.inner = untag_ptr(arg);
69435         arg_conv.is_owned = ptr_is_owned(arg);
69436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69437         arg_conv.is_owned = false;
69438         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
69439         return ret_conv;
69440 }
69441
69442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69443         LDKPaymentRelay orig_conv;
69444         orig_conv.inner = untag_ptr(orig);
69445         orig_conv.is_owned = ptr_is_owned(orig);
69446         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69447         orig_conv.is_owned = false;
69448         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
69449         int64_t ret_ref = 0;
69450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69452         return ret_ref;
69453 }
69454
69455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69456         LDKPaymentConstraints this_obj_conv;
69457         this_obj_conv.inner = untag_ptr(this_obj);
69458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69460         PaymentConstraints_free(this_obj_conv);
69461 }
69462
69463 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
69464         LDKPaymentConstraints this_ptr_conv;
69465         this_ptr_conv.inner = untag_ptr(this_ptr);
69466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69468         this_ptr_conv.is_owned = false;
69469         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
69470         return ret_conv;
69471 }
69472
69473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69474         LDKPaymentConstraints this_ptr_conv;
69475         this_ptr_conv.inner = untag_ptr(this_ptr);
69476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69478         this_ptr_conv.is_owned = false;
69479         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
69480 }
69481
69482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69483         LDKPaymentConstraints this_ptr_conv;
69484         this_ptr_conv.inner = untag_ptr(this_ptr);
69485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69487         this_ptr_conv.is_owned = false;
69488         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
69489         return ret_conv;
69490 }
69491
69492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69493         LDKPaymentConstraints this_ptr_conv;
69494         this_ptr_conv.inner = untag_ptr(this_ptr);
69495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69497         this_ptr_conv.is_owned = false;
69498         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
69499 }
69500
69501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1new(JNIEnv *env, jclass clz, int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
69502         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
69503         int64_t ret_ref = 0;
69504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69506         return ret_ref;
69507 }
69508
69509 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
69510         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
69511         int64_t ret_ref = 0;
69512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69514         return ret_ref;
69515 }
69516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69517         LDKPaymentConstraints arg_conv;
69518         arg_conv.inner = untag_ptr(arg);
69519         arg_conv.is_owned = ptr_is_owned(arg);
69520         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69521         arg_conv.is_owned = false;
69522         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
69523         return ret_conv;
69524 }
69525
69526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69527         LDKPaymentConstraints orig_conv;
69528         orig_conv.inner = untag_ptr(orig);
69529         orig_conv.is_owned = ptr_is_owned(orig);
69530         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69531         orig_conv.is_owned = false;
69532         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
69533         int64_t ret_ref = 0;
69534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69536         return ret_ref;
69537 }
69538
69539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
69540         LDKForwardTlvs obj_conv;
69541         obj_conv.inner = untag_ptr(obj);
69542         obj_conv.is_owned = ptr_is_owned(obj);
69543         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69544         obj_conv.is_owned = false;
69545         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
69546         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69547         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69548         CVec_u8Z_free(ret_var);
69549         return ret_arr;
69550 }
69551
69552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
69553         LDKReceiveTlvs obj_conv;
69554         obj_conv.inner = untag_ptr(obj);
69555         obj_conv.is_owned = ptr_is_owned(obj);
69556         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69557         obj_conv.is_owned = false;
69558         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
69559         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69560         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69561         CVec_u8Z_free(ret_var);
69562         return ret_arr;
69563 }
69564
69565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69566         LDKu8slice ser_ref;
69567         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69568         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69569         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
69570         *ret_conv = ReceiveTlvs_read(ser_ref);
69571         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69572         return tag_ptr(ret_conv, true);
69573 }
69574
69575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1write(JNIEnv *env, jclass clz, int64_t obj) {
69576         LDKPaymentRelay obj_conv;
69577         obj_conv.inner = untag_ptr(obj);
69578         obj_conv.is_owned = ptr_is_owned(obj);
69579         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69580         obj_conv.is_owned = false;
69581         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
69582         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69583         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69584         CVec_u8Z_free(ret_var);
69585         return ret_arr;
69586 }
69587
69588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69589         LDKu8slice ser_ref;
69590         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69591         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69592         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
69593         *ret_conv = PaymentRelay_read(ser_ref);
69594         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69595         return tag_ptr(ret_conv, true);
69596 }
69597
69598 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1write(JNIEnv *env, jclass clz, int64_t obj) {
69599         LDKPaymentConstraints obj_conv;
69600         obj_conv.inner = untag_ptr(obj);
69601         obj_conv.is_owned = ptr_is_owned(obj);
69602         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69603         obj_conv.is_owned = false;
69604         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
69605         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69606         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69607         CVec_u8Z_free(ret_var);
69608         return ret_arr;
69609 }
69610
69611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69612         LDKu8slice ser_ref;
69613         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69614         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69615         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
69616         *ret_conv = PaymentConstraints_read(ser_ref);
69617         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69618         return tag_ptr(ret_conv, true);
69619 }
69620
69621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69622         if (!ptr_is_owned(this_ptr)) return;
69623         void* this_ptr_ptr = untag_ptr(this_ptr);
69624         CHECK_ACCESS(this_ptr_ptr);
69625         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
69626         FREE(untag_ptr(this_ptr));
69627         PaymentPurpose_free(this_ptr_conv);
69628 }
69629
69630 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
69631         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
69632         *ret_copy = PaymentPurpose_clone(arg);
69633         int64_t ret_ref = tag_ptr(ret_copy, true);
69634         return ret_ref;
69635 }
69636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69637         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
69638         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
69639         return ret_conv;
69640 }
69641
69642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69643         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
69644         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
69645         *ret_copy = PaymentPurpose_clone(orig_conv);
69646         int64_t ret_ref = tag_ptr(ret_copy, true);
69647         return ret_ref;
69648 }
69649
69650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
69651         void* payment_preimage_ptr = untag_ptr(payment_preimage);
69652         CHECK_ACCESS(payment_preimage_ptr);
69653         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
69654         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
69655         LDKThirtyTwoBytes payment_secret_ref;
69656         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
69657         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
69658         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
69659         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
69660         int64_t ret_ref = tag_ptr(ret_copy, true);
69661         return ret_ref;
69662 }
69663
69664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
69665         LDKThirtyTwoBytes a_ref;
69666         CHECK((*env)->GetArrayLength(env, a) == 32);
69667         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
69668         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
69669         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
69670         int64_t ret_ref = tag_ptr(ret_copy, true);
69671         return ret_ref;
69672 }
69673
69674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69675         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
69676         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
69677         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
69678         return ret_conv;
69679 }
69680
69681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
69682         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
69683         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
69684         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69685         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69686         CVec_u8Z_free(ret_var);
69687         return ret_arr;
69688 }
69689
69690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69691         LDKu8slice ser_ref;
69692         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69693         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69694         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
69695         *ret_conv = PaymentPurpose_read(ser_ref);
69696         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69697         return tag_ptr(ret_conv, true);
69698 }
69699
69700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69701         LDKClaimedHTLC this_obj_conv;
69702         this_obj_conv.inner = untag_ptr(this_obj);
69703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69705         ClaimedHTLC_free(this_obj_conv);
69706 }
69707
69708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69709         LDKClaimedHTLC this_ptr_conv;
69710         this_ptr_conv.inner = untag_ptr(this_ptr);
69711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69713         this_ptr_conv.is_owned = false;
69714         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
69715         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClaimedHTLC_get_channel_id(&this_ptr_conv));
69716         return ret_arr;
69717 }
69718
69719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69720         LDKClaimedHTLC this_ptr_conv;
69721         this_ptr_conv.inner = untag_ptr(this_ptr);
69722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69724         this_ptr_conv.is_owned = false;
69725         LDKThirtyTwoBytes val_ref;
69726         CHECK((*env)->GetArrayLength(env, val) == 32);
69727         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
69728         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
69729 }
69730
69731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69732         LDKClaimedHTLC this_ptr_conv;
69733         this_ptr_conv.inner = untag_ptr(this_ptr);
69734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69736         this_ptr_conv.is_owned = false;
69737         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
69738         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes);
69739         return ret_arr;
69740 }
69741
69742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69743         LDKClaimedHTLC this_ptr_conv;
69744         this_ptr_conv.inner = untag_ptr(this_ptr);
69745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69747         this_ptr_conv.is_owned = false;
69748         LDKU128 val_ref;
69749         CHECK((*env)->GetArrayLength(env, val) == 16);
69750         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
69751         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
69752 }
69753
69754 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
69755         LDKClaimedHTLC this_ptr_conv;
69756         this_ptr_conv.inner = untag_ptr(this_ptr);
69757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69759         this_ptr_conv.is_owned = false;
69760         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
69761         return ret_conv;
69762 }
69763
69764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69765         LDKClaimedHTLC this_ptr_conv;
69766         this_ptr_conv.inner = untag_ptr(this_ptr);
69767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69769         this_ptr_conv.is_owned = false;
69770         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
69771 }
69772
69773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69774         LDKClaimedHTLC this_ptr_conv;
69775         this_ptr_conv.inner = untag_ptr(this_ptr);
69776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69778         this_ptr_conv.is_owned = false;
69779         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
69780         return ret_conv;
69781 }
69782
69783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69784         LDKClaimedHTLC this_ptr_conv;
69785         this_ptr_conv.inner = untag_ptr(this_ptr);
69786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69788         this_ptr_conv.is_owned = false;
69789         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
69790 }
69791
69792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg) {
69793         LDKThirtyTwoBytes channel_id_arg_ref;
69794         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
69795         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
69796         LDKU128 user_channel_id_arg_ref;
69797         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
69798         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
69799         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg);
69800         int64_t ret_ref = 0;
69801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69803         return ret_ref;
69804 }
69805
69806 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
69807         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
69808         int64_t ret_ref = 0;
69809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69811         return ret_ref;
69812 }
69813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69814         LDKClaimedHTLC arg_conv;
69815         arg_conv.inner = untag_ptr(arg);
69816         arg_conv.is_owned = ptr_is_owned(arg);
69817         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69818         arg_conv.is_owned = false;
69819         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
69820         return ret_conv;
69821 }
69822
69823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69824         LDKClaimedHTLC orig_conv;
69825         orig_conv.inner = untag_ptr(orig);
69826         orig_conv.is_owned = ptr_is_owned(orig);
69827         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69828         orig_conv.is_owned = false;
69829         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
69830         int64_t ret_ref = 0;
69831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69833         return ret_ref;
69834 }
69835
69836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69837         LDKClaimedHTLC a_conv;
69838         a_conv.inner = untag_ptr(a);
69839         a_conv.is_owned = ptr_is_owned(a);
69840         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69841         a_conv.is_owned = false;
69842         LDKClaimedHTLC b_conv;
69843         b_conv.inner = untag_ptr(b);
69844         b_conv.is_owned = ptr_is_owned(b);
69845         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69846         b_conv.is_owned = false;
69847         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
69848         return ret_conv;
69849 }
69850
69851 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
69852         LDKClaimedHTLC obj_conv;
69853         obj_conv.inner = untag_ptr(obj);
69854         obj_conv.is_owned = ptr_is_owned(obj);
69855         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69856         obj_conv.is_owned = false;
69857         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
69858         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69859         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69860         CVec_u8Z_free(ret_var);
69861         return ret_arr;
69862 }
69863
69864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69865         LDKu8slice ser_ref;
69866         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69867         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69868         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
69869         *ret_conv = ClaimedHTLC_read(ser_ref);
69870         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69871         return tag_ptr(ret_conv, true);
69872 }
69873
69874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69875         if (!ptr_is_owned(this_ptr)) return;
69876         void* this_ptr_ptr = untag_ptr(this_ptr);
69877         CHECK_ACCESS(this_ptr_ptr);
69878         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
69879         FREE(untag_ptr(this_ptr));
69880         PathFailure_free(this_ptr_conv);
69881 }
69882
69883 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
69884         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
69885         *ret_copy = PathFailure_clone(arg);
69886         int64_t ret_ref = tag_ptr(ret_copy, true);
69887         return ret_ref;
69888 }
69889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69890         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
69891         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
69892         return ret_conv;
69893 }
69894
69895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69896         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
69897         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
69898         *ret_copy = PathFailure_clone(orig_conv);
69899         int64_t ret_ref = tag_ptr(ret_copy, true);
69900         return ret_ref;
69901 }
69902
69903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
69904         void* err_ptr = untag_ptr(err);
69905         CHECK_ACCESS(err_ptr);
69906         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
69907         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
69908         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
69909         *ret_copy = PathFailure_initial_send(err_conv);
69910         int64_t ret_ref = tag_ptr(ret_copy, true);
69911         return ret_ref;
69912 }
69913
69914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
69915         void* network_update_ptr = untag_ptr(network_update);
69916         CHECK_ACCESS(network_update_ptr);
69917         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
69918         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
69919         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
69920         *ret_copy = PathFailure_on_path(network_update_conv);
69921         int64_t ret_ref = tag_ptr(ret_copy, true);
69922         return ret_ref;
69923 }
69924
69925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69926         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
69927         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
69928         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
69929         return ret_conv;
69930 }
69931
69932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
69933         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
69934         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
69935         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69936         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69937         CVec_u8Z_free(ret_var);
69938         return ret_arr;
69939 }
69940
69941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69942         LDKu8slice ser_ref;
69943         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69944         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69945         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
69946         *ret_conv = PathFailure_read(ser_ref);
69947         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69948         return tag_ptr(ret_conv, true);
69949 }
69950
69951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69952         if (!ptr_is_owned(this_ptr)) return;
69953         void* this_ptr_ptr = untag_ptr(this_ptr);
69954         CHECK_ACCESS(this_ptr_ptr);
69955         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
69956         FREE(untag_ptr(this_ptr));
69957         ClosureReason_free(this_ptr_conv);
69958 }
69959
69960 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
69961         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
69962         *ret_copy = ClosureReason_clone(arg);
69963         int64_t ret_ref = tag_ptr(ret_copy, true);
69964         return ret_ref;
69965 }
69966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69967         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
69968         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
69969         return ret_conv;
69970 }
69971
69972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69973         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
69974         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
69975         *ret_copy = ClosureReason_clone(orig_conv);
69976         int64_t ret_ref = tag_ptr(ret_copy, true);
69977         return ret_ref;
69978 }
69979
69980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
69981         LDKUntrustedString peer_msg_conv;
69982         peer_msg_conv.inner = untag_ptr(peer_msg);
69983         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
69984         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
69985         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
69986         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
69987         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
69988         int64_t ret_ref = tag_ptr(ret_copy, true);
69989         return ret_ref;
69990 }
69991
69992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
69993         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
69994         *ret_copy = ClosureReason_holder_force_closed();
69995         int64_t ret_ref = tag_ptr(ret_copy, true);
69996         return ret_ref;
69997 }
69998
69999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
70000         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70001         *ret_copy = ClosureReason_cooperative_closure();
70002         int64_t ret_ref = tag_ptr(ret_copy, true);
70003         return ret_ref;
70004 }
70005
70006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
70007         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70008         *ret_copy = ClosureReason_commitment_tx_confirmed();
70009         int64_t ret_ref = tag_ptr(ret_copy, true);
70010         return ret_ref;
70011 }
70012
70013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
70014         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70015         *ret_copy = ClosureReason_funding_timed_out();
70016         int64_t ret_ref = tag_ptr(ret_copy, true);
70017         return ret_ref;
70018 }
70019
70020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
70021         LDKStr err_conv = java_to_owned_str(env, err);
70022         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70023         *ret_copy = ClosureReason_processing_error(err_conv);
70024         int64_t ret_ref = tag_ptr(ret_copy, true);
70025         return ret_ref;
70026 }
70027
70028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
70029         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70030         *ret_copy = ClosureReason_disconnected_peer();
70031         int64_t ret_ref = tag_ptr(ret_copy, true);
70032         return ret_ref;
70033 }
70034
70035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
70036         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70037         *ret_copy = ClosureReason_outdated_channel_manager();
70038         int64_t ret_ref = tag_ptr(ret_copy, true);
70039         return ret_ref;
70040 }
70041
70042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
70043         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70044         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
70045         int64_t ret_ref = tag_ptr(ret_copy, true);
70046         return ret_ref;
70047 }
70048
70049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1batch_1closure(JNIEnv *env, jclass clz) {
70050         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
70051         *ret_copy = ClosureReason_funding_batch_closure();
70052         int64_t ret_ref = tag_ptr(ret_copy, true);
70053         return ret_ref;
70054 }
70055
70056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70057         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
70058         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
70059         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
70060         return ret_conv;
70061 }
70062
70063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
70064         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
70065         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
70066         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70067         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70068         CVec_u8Z_free(ret_var);
70069         return ret_arr;
70070 }
70071
70072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70073         LDKu8slice ser_ref;
70074         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70075         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70076         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
70077         *ret_conv = ClosureReason_read(ser_ref);
70078         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70079         return tag_ptr(ret_conv, true);
70080 }
70081
70082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70083         if (!ptr_is_owned(this_ptr)) return;
70084         void* this_ptr_ptr = untag_ptr(this_ptr);
70085         CHECK_ACCESS(this_ptr_ptr);
70086         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
70087         FREE(untag_ptr(this_ptr));
70088         HTLCDestination_free(this_ptr_conv);
70089 }
70090
70091 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
70092         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70093         *ret_copy = HTLCDestination_clone(arg);
70094         int64_t ret_ref = tag_ptr(ret_copy, true);
70095         return ret_ref;
70096 }
70097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70098         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
70099         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
70100         return ret_conv;
70101 }
70102
70103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70104         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
70105         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70106         *ret_copy = HTLCDestination_clone(orig_conv);
70107         int64_t ret_ref = tag_ptr(ret_copy, true);
70108         return ret_ref;
70109 }
70110
70111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int8_tArray channel_id) {
70112         LDKPublicKey node_id_ref;
70113         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70114         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70115         LDKThirtyTwoBytes channel_id_ref;
70116         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70117         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70118         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70119         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
70120         int64_t ret_ref = tag_ptr(ret_copy, true);
70121         return ret_ref;
70122 }
70123
70124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
70125         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70126         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
70127         int64_t ret_ref = tag_ptr(ret_copy, true);
70128         return ret_ref;
70129 }
70130
70131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
70132         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70133         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
70134         int64_t ret_ref = tag_ptr(ret_copy, true);
70135         return ret_ref;
70136 }
70137
70138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
70139         LDKThirtyTwoBytes payment_hash_ref;
70140         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70141         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70142         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
70143         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
70144         int64_t ret_ref = tag_ptr(ret_copy, true);
70145         return ret_ref;
70146 }
70147
70148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70149         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
70150         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
70151         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
70152         return ret_conv;
70153 }
70154
70155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
70156         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
70157         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
70158         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70159         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70160         CVec_u8Z_free(ret_var);
70161         return ret_arr;
70162 }
70163
70164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70165         LDKu8slice ser_ref;
70166         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70167         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70168         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
70169         *ret_conv = HTLCDestination_read(ser_ref);
70170         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70171         return tag_ptr(ret_conv, true);
70172 }
70173
70174 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70175         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
70176         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
70177         return ret_conv;
70178 }
70179
70180 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
70181         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
70182         return ret_conv;
70183 }
70184
70185 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
70186         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
70187         return ret_conv;
70188 }
70189
70190 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
70191         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
70192         return ret_conv;
70193 }
70194
70195 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
70196         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
70197         return ret_conv;
70198 }
70199
70200 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
70201         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
70202         return ret_conv;
70203 }
70204
70205 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
70206         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
70207         return ret_conv;
70208 }
70209
70210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70211         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
70212         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
70213         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
70214         return ret_conv;
70215 }
70216
70217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
70218         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
70219         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
70220         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70221         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70222         CVec_u8Z_free(ret_var);
70223         return ret_arr;
70224 }
70225
70226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70227         LDKu8slice ser_ref;
70228         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70229         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70230         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
70231         *ret_conv = PaymentFailureReason_read(ser_ref);
70232         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70233         return tag_ptr(ret_conv, true);
70234 }
70235
70236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70237         if (!ptr_is_owned(this_ptr)) return;
70238         void* this_ptr_ptr = untag_ptr(this_ptr);
70239         CHECK_ACCESS(this_ptr_ptr);
70240         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
70241         FREE(untag_ptr(this_ptr));
70242         Event_free(this_ptr_conv);
70243 }
70244
70245 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
70246         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70247         *ret_copy = Event_clone(arg);
70248         int64_t ret_ref = tag_ptr(ret_copy, true);
70249         return ret_ref;
70250 }
70251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70252         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
70253         int64_t ret_conv = Event_clone_ptr(arg_conv);
70254         return ret_conv;
70255 }
70256
70257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70258         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
70259         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70260         *ret_copy = Event_clone(orig_conv);
70261         int64_t ret_ref = tag_ptr(ret_copy, true);
70262         return ret_ref;
70263 }
70264
70265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
70266         LDKThirtyTwoBytes temporary_channel_id_ref;
70267         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
70268         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
70269         LDKPublicKey counterparty_node_id_ref;
70270         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70271         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70272         LDKCVec_u8Z output_script_ref;
70273         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
70274         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
70275         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
70276         LDKU128 user_channel_id_ref;
70277         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
70278         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
70279         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70280         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
70281         int64_t ret_ref = tag_ptr(ret_copy, true);
70282         return ret_ref;
70283 }
70284
70285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimable(JNIEnv *env, jclass clz, int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t onion_fields, int64_t amount_msat, int64_t counterparty_skimmed_fee_msat, int64_t purpose, int64_t via_channel_id, int64_t via_user_channel_id, int64_t claim_deadline) {
70286         LDKPublicKey receiver_node_id_ref;
70287         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
70288         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
70289         LDKThirtyTwoBytes payment_hash_ref;
70290         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70291         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70292         LDKRecipientOnionFields onion_fields_conv;
70293         onion_fields_conv.inner = untag_ptr(onion_fields);
70294         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
70295         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
70296         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
70297         void* purpose_ptr = untag_ptr(purpose);
70298         CHECK_ACCESS(purpose_ptr);
70299         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
70300         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
70301         void* via_channel_id_ptr = untag_ptr(via_channel_id);
70302         CHECK_ACCESS(via_channel_id_ptr);
70303         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
70304         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
70305         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
70306         CHECK_ACCESS(via_user_channel_id_ptr);
70307         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
70308         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
70309         void* claim_deadline_ptr = untag_ptr(claim_deadline);
70310         CHECK_ACCESS(claim_deadline_ptr);
70311         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
70312         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
70313         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70314         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, counterparty_skimmed_fee_msat, purpose_conv, via_channel_id_conv, via_user_channel_id_conv, claim_deadline_conv);
70315         int64_t ret_ref = tag_ptr(ret_copy, true);
70316         return ret_ref;
70317 }
70318
70319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimed(JNIEnv *env, jclass clz, int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, int64_t purpose, int64_tArray htlcs, int64_t sender_intended_total_msat) {
70320         LDKPublicKey receiver_node_id_ref;
70321         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
70322         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
70323         LDKThirtyTwoBytes payment_hash_ref;
70324         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70325         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70326         void* purpose_ptr = untag_ptr(purpose);
70327         CHECK_ACCESS(purpose_ptr);
70328         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
70329         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
70330         LDKCVec_ClaimedHTLCZ htlcs_constr;
70331         htlcs_constr.datalen = (*env)->GetArrayLength(env, htlcs);
70332         if (htlcs_constr.datalen > 0)
70333                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
70334         else
70335                 htlcs_constr.data = NULL;
70336         int64_t* htlcs_vals = (*env)->GetLongArrayElements (env, htlcs, NULL);
70337         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
70338                 int64_t htlcs_conv_13 = htlcs_vals[n];
70339                 LDKClaimedHTLC htlcs_conv_13_conv;
70340                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
70341                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
70342                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
70343                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
70344                 htlcs_constr.data[n] = htlcs_conv_13_conv;
70345         }
70346         (*env)->ReleaseLongArrayElements(env, htlcs, htlcs_vals, 0);
70347         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
70348         CHECK_ACCESS(sender_intended_total_msat_ptr);
70349         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
70350         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
70351         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70352         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
70353         int64_t ret_ref = tag_ptr(ret_copy, true);
70354         return ret_ref;
70355 }
70356
70357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int64_t payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
70358         void* payment_id_ptr = untag_ptr(payment_id);
70359         CHECK_ACCESS(payment_id_ptr);
70360         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
70361         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
70362         LDKThirtyTwoBytes payment_preimage_ref;
70363         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
70364         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
70365         LDKThirtyTwoBytes payment_hash_ref;
70366         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70367         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70368         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
70369         CHECK_ACCESS(fee_paid_msat_ptr);
70370         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
70371         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
70372         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70373         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
70374         int64_t ret_ref = tag_ptr(ret_copy, true);
70375         return ret_ref;
70376 }
70377
70378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t reason) {
70379         LDKThirtyTwoBytes payment_id_ref;
70380         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
70381         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
70382         LDKThirtyTwoBytes payment_hash_ref;
70383         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70384         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70385         void* reason_ptr = untag_ptr(reason);
70386         CHECK_ACCESS(reason_ptr);
70387         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
70388         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
70389         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70390         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
70391         int64_t ret_ref = tag_ptr(ret_copy, true);
70392         return ret_ref;
70393 }
70394
70395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash, int64_t path) {
70396         LDKThirtyTwoBytes payment_id_ref;
70397         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
70398         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
70399         void* payment_hash_ptr = untag_ptr(payment_hash);
70400         CHECK_ACCESS(payment_hash_ptr);
70401         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
70402         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
70403         LDKPath path_conv;
70404         path_conv.inner = untag_ptr(path);
70405         path_conv.is_owned = ptr_is_owned(path);
70406         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70407         path_conv = Path_clone(&path_conv);
70408         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70409         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
70410         int64_t ret_ref = tag_ptr(ret_copy, true);
70411         return ret_ref;
70412 }
70413
70414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t failure, int64_t path, int64_t short_channel_id) {
70415         void* payment_id_ptr = untag_ptr(payment_id);
70416         CHECK_ACCESS(payment_id_ptr);
70417         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
70418         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
70419         LDKThirtyTwoBytes payment_hash_ref;
70420         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70421         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70422         void* failure_ptr = untag_ptr(failure);
70423         CHECK_ACCESS(failure_ptr);
70424         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
70425         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
70426         LDKPath path_conv;
70427         path_conv.inner = untag_ptr(path);
70428         path_conv.is_owned = ptr_is_owned(path);
70429         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70430         path_conv = Path_clone(&path_conv);
70431         void* short_channel_id_ptr = untag_ptr(short_channel_id);
70432         CHECK_ACCESS(short_channel_id_ptr);
70433         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
70434         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
70435         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70436         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
70437         int64_t ret_ref = tag_ptr(ret_copy, true);
70438         return ret_ref;
70439 }
70440
70441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t path) {
70442         LDKThirtyTwoBytes payment_id_ref;
70443         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
70444         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
70445         LDKThirtyTwoBytes payment_hash_ref;
70446         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70447         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70448         LDKPath path_conv;
70449         path_conv.inner = untag_ptr(path);
70450         path_conv.is_owned = ptr_is_owned(path);
70451         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70452         path_conv = Path_clone(&path_conv);
70453         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70454         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
70455         int64_t ret_ref = tag_ptr(ret_copy, true);
70456         return ret_ref;
70457 }
70458
70459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t path, int64_t short_channel_id) {
70460         LDKThirtyTwoBytes payment_id_ref;
70461         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
70462         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
70463         LDKThirtyTwoBytes payment_hash_ref;
70464         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70465         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70466         LDKPath path_conv;
70467         path_conv.inner = untag_ptr(path);
70468         path_conv.is_owned = ptr_is_owned(path);
70469         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70470         path_conv = Path_clone(&path_conv);
70471         void* short_channel_id_ptr = untag_ptr(short_channel_id);
70472         CHECK_ACCESS(short_channel_id_ptr);
70473         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
70474         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
70475         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70476         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
70477         int64_t ret_ref = tag_ptr(ret_copy, true);
70478         return ret_ref;
70479 }
70480
70481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
70482         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70483         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
70484         int64_t ret_ref = tag_ptr(ret_copy, true);
70485         return ret_ref;
70486 }
70487
70488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlcintercepted(JNIEnv *env, jclass clz, int8_tArray intercept_id, int64_t requested_next_hop_scid, int8_tArray payment_hash, int64_t inbound_amount_msat, int64_t expected_outbound_amount_msat) {
70489         LDKThirtyTwoBytes intercept_id_ref;
70490         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
70491         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
70492         LDKThirtyTwoBytes payment_hash_ref;
70493         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
70494         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
70495         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70496         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
70497         int64_t ret_ref = tag_ptr(ret_copy, true);
70498         return ret_ref;
70499 }
70500
70501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs, int64_t channel_id) {
70502         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
70503         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
70504         if (outputs_constr.datalen > 0)
70505                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
70506         else
70507                 outputs_constr.data = NULL;
70508         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
70509         for (size_t b = 0; b < outputs_constr.datalen; b++) {
70510                 int64_t outputs_conv_27 = outputs_vals[b];
70511                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
70512                 CHECK_ACCESS(outputs_conv_27_ptr);
70513                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
70514                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
70515                 outputs_constr.data[b] = outputs_conv_27_conv;
70516         }
70517         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
70518         void* channel_id_ptr = untag_ptr(channel_id);
70519         CHECK_ACCESS(channel_id_ptr);
70520         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
70521         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
70522         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70523         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
70524         int64_t ret_ref = tag_ptr(ret_copy, true);
70525         return ret_ref;
70526 }
70527
70528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t prev_channel_id, int64_t next_channel_id, int64_t fee_earned_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
70529         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
70530         CHECK_ACCESS(prev_channel_id_ptr);
70531         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
70532         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
70533         void* next_channel_id_ptr = untag_ptr(next_channel_id);
70534         CHECK_ACCESS(next_channel_id_ptr);
70535         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
70536         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
70537         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
70538         CHECK_ACCESS(fee_earned_msat_ptr);
70539         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
70540         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
70541         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
70542         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
70543         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
70544         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
70545         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70546         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
70547         int64_t ret_ref = tag_ptr(ret_copy, true);
70548         return ret_ref;
70549 }
70550
70551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1pending(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo) {
70552         LDKThirtyTwoBytes channel_id_ref;
70553         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70554         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70555         LDKU128 user_channel_id_ref;
70556         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
70557         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
70558         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
70559         CHECK_ACCESS(former_temporary_channel_id_ptr);
70560         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
70561         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
70562         LDKPublicKey counterparty_node_id_ref;
70563         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70564         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70565         LDKOutPoint funding_txo_conv;
70566         funding_txo_conv.inner = untag_ptr(funding_txo);
70567         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
70568         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
70569         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
70570         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70571         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
70572         int64_t ret_ref = tag_ptr(ret_copy, true);
70573         return ret_ref;
70574 }
70575
70576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
70577         LDKThirtyTwoBytes channel_id_ref;
70578         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70579         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70580         LDKU128 user_channel_id_ref;
70581         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
70582         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
70583         LDKPublicKey counterparty_node_id_ref;
70584         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70585         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70586         LDKChannelTypeFeatures channel_type_conv;
70587         channel_type_conv.inner = untag_ptr(channel_type);
70588         channel_type_conv.is_owned = ptr_is_owned(channel_type);
70589         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
70590         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
70591         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70592         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
70593         int64_t ret_ref = tag_ptr(ret_copy, true);
70594         return ret_ref;
70595 }
70596
70597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int64_t reason, int8_tArray counterparty_node_id, int64_t channel_capacity_sats) {
70598         LDKThirtyTwoBytes channel_id_ref;
70599         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70600         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70601         LDKU128 user_channel_id_ref;
70602         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
70603         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
70604         void* reason_ptr = untag_ptr(reason);
70605         CHECK_ACCESS(reason_ptr);
70606         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
70607         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
70608         LDKPublicKey counterparty_node_id_ref;
70609         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70610         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70611         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
70612         CHECK_ACCESS(channel_capacity_sats_ptr);
70613         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
70614         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
70615         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70616         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv);
70617         int64_t ret_ref = tag_ptr(ret_copy, true);
70618         return ret_ref;
70619 }
70620
70621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
70622         LDKThirtyTwoBytes channel_id_ref;
70623         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
70624         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
70625         LDKTransaction transaction_ref;
70626         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
70627         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
70628         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
70629         transaction_ref.data_is_owned = true;
70630         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70631         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
70632         int64_t ret_ref = tag_ptr(ret_copy, true);
70633         return ret_ref;
70634 }
70635
70636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
70637         LDKThirtyTwoBytes temporary_channel_id_ref;
70638         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
70639         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
70640         LDKPublicKey counterparty_node_id_ref;
70641         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
70642         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
70643         LDKChannelTypeFeatures channel_type_conv;
70644         channel_type_conv.inner = untag_ptr(channel_type);
70645         channel_type_conv.is_owned = ptr_is_owned(channel_type);
70646         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
70647         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
70648         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70649         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
70650         int64_t ret_ref = tag_ptr(ret_copy, true);
70651         return ret_ref;
70652 }
70653
70654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int64_t failed_next_destination) {
70655         LDKThirtyTwoBytes prev_channel_id_ref;
70656         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
70657         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
70658         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
70659         CHECK_ACCESS(failed_next_destination_ptr);
70660         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
70661         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
70662         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70663         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
70664         int64_t ret_ref = tag_ptr(ret_copy, true);
70665         return ret_ref;
70666 }
70667
70668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
70669         void* a_ptr = untag_ptr(a);
70670         CHECK_ACCESS(a_ptr);
70671         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
70672         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
70673         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
70674         *ret_copy = Event_bump_transaction(a_conv);
70675         int64_t ret_ref = tag_ptr(ret_copy, true);
70676         return ret_ref;
70677 }
70678
70679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70680         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
70681         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
70682         jboolean ret_conv = Event_eq(a_conv, b_conv);
70683         return ret_conv;
70684 }
70685
70686 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
70687         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
70688         LDKCVec_u8Z ret_var = Event_write(obj_conv);
70689         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70690         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70691         CVec_u8Z_free(ret_var);
70692         return ret_arr;
70693 }
70694
70695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70696         LDKu8slice ser_ref;
70697         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70698         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70699         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
70700         *ret_conv = Event_read(ser_ref);
70701         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70702         return tag_ptr(ret_conv, true);
70703 }
70704
70705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70706         if (!ptr_is_owned(this_ptr)) return;
70707         void* this_ptr_ptr = untag_ptr(this_ptr);
70708         CHECK_ACCESS(this_ptr_ptr);
70709         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
70710         FREE(untag_ptr(this_ptr));
70711         MessageSendEvent_free(this_ptr_conv);
70712 }
70713
70714 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
70715         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70716         *ret_copy = MessageSendEvent_clone(arg);
70717         int64_t ret_ref = tag_ptr(ret_copy, true);
70718         return ret_ref;
70719 }
70720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70721         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
70722         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
70723         return ret_conv;
70724 }
70725
70726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70727         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
70728         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70729         *ret_copy = MessageSendEvent_clone(orig_conv);
70730         int64_t ret_ref = tag_ptr(ret_copy, true);
70731         return ret_ref;
70732 }
70733
70734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70735         LDKPublicKey node_id_ref;
70736         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70737         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70738         LDKAcceptChannel msg_conv;
70739         msg_conv.inner = untag_ptr(msg);
70740         msg_conv.is_owned = ptr_is_owned(msg);
70741         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70742         msg_conv = AcceptChannel_clone(&msg_conv);
70743         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70744         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
70745         int64_t ret_ref = tag_ptr(ret_copy, true);
70746         return ret_ref;
70747 }
70748
70749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel_1v2(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70750         LDKPublicKey node_id_ref;
70751         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70752         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70753         LDKAcceptChannelV2 msg_conv;
70754         msg_conv.inner = untag_ptr(msg);
70755         msg_conv.is_owned = ptr_is_owned(msg);
70756         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70757         msg_conv = AcceptChannelV2_clone(&msg_conv);
70758         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70759         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
70760         int64_t ret_ref = tag_ptr(ret_copy, true);
70761         return ret_ref;
70762 }
70763
70764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70765         LDKPublicKey node_id_ref;
70766         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70767         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70768         LDKOpenChannel msg_conv;
70769         msg_conv.inner = untag_ptr(msg);
70770         msg_conv.is_owned = ptr_is_owned(msg);
70771         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70772         msg_conv = OpenChannel_clone(&msg_conv);
70773         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70774         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
70775         int64_t ret_ref = tag_ptr(ret_copy, true);
70776         return ret_ref;
70777 }
70778
70779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel_1v2(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70780         LDKPublicKey node_id_ref;
70781         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70782         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70783         LDKOpenChannelV2 msg_conv;
70784         msg_conv.inner = untag_ptr(msg);
70785         msg_conv.is_owned = ptr_is_owned(msg);
70786         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70787         msg_conv = OpenChannelV2_clone(&msg_conv);
70788         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70789         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
70790         int64_t ret_ref = tag_ptr(ret_copy, true);
70791         return ret_ref;
70792 }
70793
70794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70795         LDKPublicKey node_id_ref;
70796         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70797         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70798         LDKFundingCreated msg_conv;
70799         msg_conv.inner = untag_ptr(msg);
70800         msg_conv.is_owned = ptr_is_owned(msg);
70801         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70802         msg_conv = FundingCreated_clone(&msg_conv);
70803         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70804         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
70805         int64_t ret_ref = tag_ptr(ret_copy, true);
70806         return ret_ref;
70807 }
70808
70809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70810         LDKPublicKey node_id_ref;
70811         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70812         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70813         LDKFundingSigned msg_conv;
70814         msg_conv.inner = untag_ptr(msg);
70815         msg_conv.is_owned = ptr_is_owned(msg);
70816         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70817         msg_conv = FundingSigned_clone(&msg_conv);
70818         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70819         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
70820         int64_t ret_ref = tag_ptr(ret_copy, true);
70821         return ret_ref;
70822 }
70823
70824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1add_1input(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70825         LDKPublicKey node_id_ref;
70826         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70827         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70828         LDKTxAddInput msg_conv;
70829         msg_conv.inner = untag_ptr(msg);
70830         msg_conv.is_owned = ptr_is_owned(msg);
70831         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70832         msg_conv = TxAddInput_clone(&msg_conv);
70833         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70834         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
70835         int64_t ret_ref = tag_ptr(ret_copy, true);
70836         return ret_ref;
70837 }
70838
70839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1add_1output(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70840         LDKPublicKey node_id_ref;
70841         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70842         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70843         LDKTxAddOutput msg_conv;
70844         msg_conv.inner = untag_ptr(msg);
70845         msg_conv.is_owned = ptr_is_owned(msg);
70846         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70847         msg_conv = TxAddOutput_clone(&msg_conv);
70848         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70849         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
70850         int64_t ret_ref = tag_ptr(ret_copy, true);
70851         return ret_ref;
70852 }
70853
70854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1remove_1input(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70855         LDKPublicKey node_id_ref;
70856         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70857         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70858         LDKTxRemoveInput msg_conv;
70859         msg_conv.inner = untag_ptr(msg);
70860         msg_conv.is_owned = ptr_is_owned(msg);
70861         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70862         msg_conv = TxRemoveInput_clone(&msg_conv);
70863         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70864         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
70865         int64_t ret_ref = tag_ptr(ret_copy, true);
70866         return ret_ref;
70867 }
70868
70869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1remove_1output(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70870         LDKPublicKey node_id_ref;
70871         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70872         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70873         LDKTxRemoveOutput msg_conv;
70874         msg_conv.inner = untag_ptr(msg);
70875         msg_conv.is_owned = ptr_is_owned(msg);
70876         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70877         msg_conv = TxRemoveOutput_clone(&msg_conv);
70878         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70879         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
70880         int64_t ret_ref = tag_ptr(ret_copy, true);
70881         return ret_ref;
70882 }
70883
70884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70885         LDKPublicKey node_id_ref;
70886         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70887         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70888         LDKTxComplete msg_conv;
70889         msg_conv.inner = untag_ptr(msg);
70890         msg_conv.is_owned = ptr_is_owned(msg);
70891         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70892         msg_conv = TxComplete_clone(&msg_conv);
70893         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70894         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
70895         int64_t ret_ref = tag_ptr(ret_copy, true);
70896         return ret_ref;
70897 }
70898
70899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70900         LDKPublicKey node_id_ref;
70901         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70902         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70903         LDKTxSignatures msg_conv;
70904         msg_conv.inner = untag_ptr(msg);
70905         msg_conv.is_owned = ptr_is_owned(msg);
70906         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70907         msg_conv = TxSignatures_clone(&msg_conv);
70908         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70909         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
70910         int64_t ret_ref = tag_ptr(ret_copy, true);
70911         return ret_ref;
70912 }
70913
70914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1init_1rbf(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70915         LDKPublicKey node_id_ref;
70916         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70917         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70918         LDKTxInitRbf msg_conv;
70919         msg_conv.inner = untag_ptr(msg);
70920         msg_conv.is_owned = ptr_is_owned(msg);
70921         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70922         msg_conv = TxInitRbf_clone(&msg_conv);
70923         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70924         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
70925         int64_t ret_ref = tag_ptr(ret_copy, true);
70926         return ret_ref;
70927 }
70928
70929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1ack_1rbf(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70930         LDKPublicKey node_id_ref;
70931         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70932         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70933         LDKTxAckRbf msg_conv;
70934         msg_conv.inner = untag_ptr(msg);
70935         msg_conv.is_owned = ptr_is_owned(msg);
70936         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70937         msg_conv = TxAckRbf_clone(&msg_conv);
70938         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70939         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
70940         int64_t ret_ref = tag_ptr(ret_copy, true);
70941         return ret_ref;
70942 }
70943
70944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70945         LDKPublicKey node_id_ref;
70946         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70947         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70948         LDKTxAbort msg_conv;
70949         msg_conv.inner = untag_ptr(msg);
70950         msg_conv.is_owned = ptr_is_owned(msg);
70951         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70952         msg_conv = TxAbort_clone(&msg_conv);
70953         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70954         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
70955         int64_t ret_ref = tag_ptr(ret_copy, true);
70956         return ret_ref;
70957 }
70958
70959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70960         LDKPublicKey node_id_ref;
70961         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70962         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70963         LDKChannelReady msg_conv;
70964         msg_conv.inner = untag_ptr(msg);
70965         msg_conv.is_owned = ptr_is_owned(msg);
70966         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70967         msg_conv = ChannelReady_clone(&msg_conv);
70968         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70969         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
70970         int64_t ret_ref = tag_ptr(ret_copy, true);
70971         return ret_ref;
70972 }
70973
70974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
70975         LDKPublicKey node_id_ref;
70976         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70977         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70978         LDKAnnouncementSignatures msg_conv;
70979         msg_conv.inner = untag_ptr(msg);
70980         msg_conv.is_owned = ptr_is_owned(msg);
70981         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70982         msg_conv = AnnouncementSignatures_clone(&msg_conv);
70983         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70984         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
70985         int64_t ret_ref = tag_ptr(ret_copy, true);
70986         return ret_ref;
70987 }
70988
70989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
70990         LDKPublicKey node_id_ref;
70991         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70992         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70993         LDKCommitmentUpdate updates_conv;
70994         updates_conv.inner = untag_ptr(updates);
70995         updates_conv.is_owned = ptr_is_owned(updates);
70996         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
70997         updates_conv = CommitmentUpdate_clone(&updates_conv);
70998         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
70999         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
71000         int64_t ret_ref = tag_ptr(ret_copy, true);
71001         return ret_ref;
71002 }
71003
71004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1revoke_1and_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71005         LDKPublicKey node_id_ref;
71006         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71007         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71008         LDKRevokeAndACK msg_conv;
71009         msg_conv.inner = untag_ptr(msg);
71010         msg_conv.is_owned = ptr_is_owned(msg);
71011         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71012         msg_conv = RevokeAndACK_clone(&msg_conv);
71013         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71014         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
71015         int64_t ret_ref = tag_ptr(ret_copy, true);
71016         return ret_ref;
71017 }
71018
71019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71020         LDKPublicKey node_id_ref;
71021         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71022         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71023         LDKClosingSigned msg_conv;
71024         msg_conv.inner = untag_ptr(msg);
71025         msg_conv.is_owned = ptr_is_owned(msg);
71026         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71027         msg_conv = ClosingSigned_clone(&msg_conv);
71028         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71029         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
71030         int64_t ret_ref = tag_ptr(ret_copy, true);
71031         return ret_ref;
71032 }
71033
71034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71035         LDKPublicKey node_id_ref;
71036         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71037         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71038         LDKShutdown msg_conv;
71039         msg_conv.inner = untag_ptr(msg);
71040         msg_conv.is_owned = ptr_is_owned(msg);
71041         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71042         msg_conv = Shutdown_clone(&msg_conv);
71043         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71044         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
71045         int64_t ret_ref = tag_ptr(ret_copy, true);
71046         return ret_ref;
71047 }
71048
71049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71050         LDKPublicKey node_id_ref;
71051         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71052         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71053         LDKChannelReestablish msg_conv;
71054         msg_conv.inner = untag_ptr(msg);
71055         msg_conv.is_owned = ptr_is_owned(msg);
71056         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71057         msg_conv = ChannelReestablish_clone(&msg_conv);
71058         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71059         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
71060         int64_t ret_ref = tag_ptr(ret_copy, true);
71061         return ret_ref;
71062 }
71063
71064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1announcement(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg, int64_t update_msg) {
71065         LDKPublicKey node_id_ref;
71066         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71067         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71068         LDKChannelAnnouncement msg_conv;
71069         msg_conv.inner = untag_ptr(msg);
71070         msg_conv.is_owned = ptr_is_owned(msg);
71071         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71072         msg_conv = ChannelAnnouncement_clone(&msg_conv);
71073         LDKChannelUpdate update_msg_conv;
71074         update_msg_conv.inner = untag_ptr(update_msg);
71075         update_msg_conv.is_owned = ptr_is_owned(update_msg);
71076         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
71077         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
71078         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71079         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
71080         int64_t ret_ref = tag_ptr(ret_copy, true);
71081         return ret_ref;
71082 }
71083
71084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
71085         LDKChannelAnnouncement msg_conv;
71086         msg_conv.inner = untag_ptr(msg);
71087         msg_conv.is_owned = ptr_is_owned(msg);
71088         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71089         msg_conv = ChannelAnnouncement_clone(&msg_conv);
71090         LDKChannelUpdate update_msg_conv;
71091         update_msg_conv.inner = untag_ptr(update_msg);
71092         update_msg_conv.is_owned = ptr_is_owned(update_msg);
71093         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
71094         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
71095         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71096         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
71097         int64_t ret_ref = tag_ptr(ret_copy, true);
71098         return ret_ref;
71099 }
71100
71101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
71102         LDKChannelUpdate msg_conv;
71103         msg_conv.inner = untag_ptr(msg);
71104         msg_conv.is_owned = ptr_is_owned(msg);
71105         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71106         msg_conv = ChannelUpdate_clone(&msg_conv);
71107         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71108         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
71109         int64_t ret_ref = tag_ptr(ret_copy, true);
71110         return ret_ref;
71111 }
71112
71113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
71114         LDKNodeAnnouncement msg_conv;
71115         msg_conv.inner = untag_ptr(msg);
71116         msg_conv.is_owned = ptr_is_owned(msg);
71117         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71118         msg_conv = NodeAnnouncement_clone(&msg_conv);
71119         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71120         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
71121         int64_t ret_ref = tag_ptr(ret_copy, true);
71122         return ret_ref;
71123 }
71124
71125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71126         LDKPublicKey node_id_ref;
71127         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71128         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71129         LDKChannelUpdate msg_conv;
71130         msg_conv.inner = untag_ptr(msg);
71131         msg_conv.is_owned = ptr_is_owned(msg);
71132         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71133         msg_conv = ChannelUpdate_clone(&msg_conv);
71134         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71135         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
71136         int64_t ret_ref = tag_ptr(ret_copy, true);
71137         return ret_ref;
71138 }
71139
71140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
71141         LDKPublicKey node_id_ref;
71142         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71143         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71144         void* action_ptr = untag_ptr(action);
71145         CHECK_ACCESS(action_ptr);
71146         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
71147         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
71148         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71149         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
71150         int64_t ret_ref = tag_ptr(ret_copy, true);
71151         return ret_ref;
71152 }
71153
71154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71155         LDKPublicKey node_id_ref;
71156         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71157         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71158         LDKQueryChannelRange msg_conv;
71159         msg_conv.inner = untag_ptr(msg);
71160         msg_conv.is_owned = ptr_is_owned(msg);
71161         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71162         msg_conv = QueryChannelRange_clone(&msg_conv);
71163         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71164         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
71165         int64_t ret_ref = tag_ptr(ret_copy, true);
71166         return ret_ref;
71167 }
71168
71169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short_1ids_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71170         LDKPublicKey node_id_ref;
71171         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71172         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71173         LDKQueryShortChannelIds msg_conv;
71174         msg_conv.inner = untag_ptr(msg);
71175         msg_conv.is_owned = ptr_is_owned(msg);
71176         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71177         msg_conv = QueryShortChannelIds_clone(&msg_conv);
71178         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71179         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
71180         int64_t ret_ref = tag_ptr(ret_copy, true);
71181         return ret_ref;
71182 }
71183
71184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71185         LDKPublicKey node_id_ref;
71186         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71187         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71188         LDKReplyChannelRange msg_conv;
71189         msg_conv.inner = untag_ptr(msg);
71190         msg_conv.is_owned = ptr_is_owned(msg);
71191         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71192         msg_conv = ReplyChannelRange_clone(&msg_conv);
71193         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71194         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
71195         int64_t ret_ref = tag_ptr(ret_copy, true);
71196         return ret_ref;
71197 }
71198
71199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1gossip_1timestamp_1filter(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
71200         LDKPublicKey node_id_ref;
71201         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71202         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71203         LDKGossipTimestampFilter msg_conv;
71204         msg_conv.inner = untag_ptr(msg);
71205         msg_conv.is_owned = ptr_is_owned(msg);
71206         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71207         msg_conv = GossipTimestampFilter_clone(&msg_conv);
71208         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
71209         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
71210         int64_t ret_ref = tag_ptr(ret_copy, true);
71211         return ret_ref;
71212 }
71213
71214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71215         if (!ptr_is_owned(this_ptr)) return;
71216         void* this_ptr_ptr = untag_ptr(this_ptr);
71217         CHECK_ACCESS(this_ptr_ptr);
71218         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
71219         FREE(untag_ptr(this_ptr));
71220         MessageSendEventsProvider_free(this_ptr_conv);
71221 }
71222
71223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71224         if (!ptr_is_owned(this_ptr)) return;
71225         void* this_ptr_ptr = untag_ptr(this_ptr);
71226         CHECK_ACCESS(this_ptr_ptr);
71227         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
71228         FREE(untag_ptr(this_ptr));
71229         OnionMessageProvider_free(this_ptr_conv);
71230 }
71231
71232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71233         if (!ptr_is_owned(this_ptr)) return;
71234         void* this_ptr_ptr = untag_ptr(this_ptr);
71235         CHECK_ACCESS(this_ptr_ptr);
71236         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
71237         FREE(untag_ptr(this_ptr));
71238         EventsProvider_free(this_ptr_conv);
71239 }
71240
71241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71242         if (!ptr_is_owned(this_ptr)) return;
71243         void* this_ptr_ptr = untag_ptr(this_ptr);
71244         CHECK_ACCESS(this_ptr_ptr);
71245         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
71246         FREE(untag_ptr(this_ptr));
71247         EventHandler_free(this_ptr_conv);
71248 }
71249
71250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71251         LDKChannelDerivationParameters this_obj_conv;
71252         this_obj_conv.inner = untag_ptr(this_obj);
71253         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71255         ChannelDerivationParameters_free(this_obj_conv);
71256 }
71257
71258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
71259         LDKChannelDerivationParameters this_ptr_conv;
71260         this_ptr_conv.inner = untag_ptr(this_ptr);
71261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71263         this_ptr_conv.is_owned = false;
71264         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
71265         return ret_conv;
71266 }
71267
71268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71269         LDKChannelDerivationParameters this_ptr_conv;
71270         this_ptr_conv.inner = untag_ptr(this_ptr);
71271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71273         this_ptr_conv.is_owned = false;
71274         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
71275 }
71276
71277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71278         LDKChannelDerivationParameters this_ptr_conv;
71279         this_ptr_conv.inner = untag_ptr(this_ptr);
71280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71282         this_ptr_conv.is_owned = false;
71283         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
71284         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
71285         return ret_arr;
71286 }
71287
71288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71289         LDKChannelDerivationParameters this_ptr_conv;
71290         this_ptr_conv.inner = untag_ptr(this_ptr);
71291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71293         this_ptr_conv.is_owned = false;
71294         LDKThirtyTwoBytes val_ref;
71295         CHECK((*env)->GetArrayLength(env, val) == 32);
71296         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
71297         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
71298 }
71299
71300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
71301         LDKChannelDerivationParameters this_ptr_conv;
71302         this_ptr_conv.inner = untag_ptr(this_ptr);
71303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71305         this_ptr_conv.is_owned = false;
71306         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
71307         int64_t ret_ref = 0;
71308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71310         return ret_ref;
71311 }
71312
71313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71314         LDKChannelDerivationParameters this_ptr_conv;
71315         this_ptr_conv.inner = untag_ptr(this_ptr);
71316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71318         this_ptr_conv.is_owned = false;
71319         LDKChannelTransactionParameters val_conv;
71320         val_conv.inner = untag_ptr(val);
71321         val_conv.is_owned = ptr_is_owned(val);
71322         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71323         val_conv = ChannelTransactionParameters_clone(&val_conv);
71324         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
71325 }
71326
71327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1new(JNIEnv *env, jclass clz, int64_t value_satoshis_arg, int8_tArray keys_id_arg, int64_t transaction_parameters_arg) {
71328         LDKThirtyTwoBytes keys_id_arg_ref;
71329         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
71330         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
71331         LDKChannelTransactionParameters transaction_parameters_arg_conv;
71332         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
71333         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
71334         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
71335         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
71336         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
71337         int64_t ret_ref = 0;
71338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71340         return ret_ref;
71341 }
71342
71343 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
71344         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
71345         int64_t ret_ref = 0;
71346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71348         return ret_ref;
71349 }
71350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71351         LDKChannelDerivationParameters arg_conv;
71352         arg_conv.inner = untag_ptr(arg);
71353         arg_conv.is_owned = ptr_is_owned(arg);
71354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71355         arg_conv.is_owned = false;
71356         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
71357         return ret_conv;
71358 }
71359
71360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71361         LDKChannelDerivationParameters orig_conv;
71362         orig_conv.inner = untag_ptr(orig);
71363         orig_conv.is_owned = ptr_is_owned(orig);
71364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71365         orig_conv.is_owned = false;
71366         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
71367         int64_t ret_ref = 0;
71368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71370         return ret_ref;
71371 }
71372
71373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71374         LDKChannelDerivationParameters a_conv;
71375         a_conv.inner = untag_ptr(a);
71376         a_conv.is_owned = ptr_is_owned(a);
71377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71378         a_conv.is_owned = false;
71379         LDKChannelDerivationParameters b_conv;
71380         b_conv.inner = untag_ptr(b);
71381         b_conv.is_owned = ptr_is_owned(b);
71382         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71383         b_conv.is_owned = false;
71384         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
71385         return ret_conv;
71386 }
71387
71388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
71389         LDKChannelDerivationParameters obj_conv;
71390         obj_conv.inner = untag_ptr(obj);
71391         obj_conv.is_owned = ptr_is_owned(obj);
71392         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71393         obj_conv.is_owned = false;
71394         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
71395         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71396         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71397         CVec_u8Z_free(ret_var);
71398         return ret_arr;
71399 }
71400
71401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71402         LDKu8slice ser_ref;
71403         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71404         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71405         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
71406         *ret_conv = ChannelDerivationParameters_read(ser_ref);
71407         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71408         return tag_ptr(ret_conv, true);
71409 }
71410
71411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71412         LDKAnchorDescriptor this_obj_conv;
71413         this_obj_conv.inner = untag_ptr(this_obj);
71414         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71416         AnchorDescriptor_free(this_obj_conv);
71417 }
71418
71419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
71420         LDKAnchorDescriptor this_ptr_conv;
71421         this_ptr_conv.inner = untag_ptr(this_ptr);
71422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71424         this_ptr_conv.is_owned = false;
71425         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
71426         int64_t ret_ref = 0;
71427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71429         return ret_ref;
71430 }
71431
71432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71433         LDKAnchorDescriptor this_ptr_conv;
71434         this_ptr_conv.inner = untag_ptr(this_ptr);
71435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71437         this_ptr_conv.is_owned = false;
71438         LDKChannelDerivationParameters val_conv;
71439         val_conv.inner = untag_ptr(val);
71440         val_conv.is_owned = ptr_is_owned(val);
71441         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71442         val_conv = ChannelDerivationParameters_clone(&val_conv);
71443         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
71444 }
71445
71446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
71447         LDKAnchorDescriptor this_ptr_conv;
71448         this_ptr_conv.inner = untag_ptr(this_ptr);
71449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71451         this_ptr_conv.is_owned = false;
71452         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
71453         int64_t ret_ref = 0;
71454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71456         return ret_ref;
71457 }
71458
71459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71460         LDKAnchorDescriptor this_ptr_conv;
71461         this_ptr_conv.inner = untag_ptr(this_ptr);
71462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71464         this_ptr_conv.is_owned = false;
71465         LDKOutPoint val_conv;
71466         val_conv.inner = untag_ptr(val);
71467         val_conv.is_owned = ptr_is_owned(val);
71468         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71469         val_conv = OutPoint_clone(&val_conv);
71470         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
71471 }
71472
71473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1new(JNIEnv *env, jclass clz, int64_t channel_derivation_parameters_arg, int64_t outpoint_arg) {
71474         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
71475         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
71476         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
71477         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
71478         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
71479         LDKOutPoint outpoint_arg_conv;
71480         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
71481         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
71482         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
71483         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
71484         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
71485         int64_t ret_ref = 0;
71486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71488         return ret_ref;
71489 }
71490
71491 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
71492         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
71493         int64_t ret_ref = 0;
71494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71496         return ret_ref;
71497 }
71498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71499         LDKAnchorDescriptor arg_conv;
71500         arg_conv.inner = untag_ptr(arg);
71501         arg_conv.is_owned = ptr_is_owned(arg);
71502         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71503         arg_conv.is_owned = false;
71504         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
71505         return ret_conv;
71506 }
71507
71508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71509         LDKAnchorDescriptor orig_conv;
71510         orig_conv.inner = untag_ptr(orig);
71511         orig_conv.is_owned = ptr_is_owned(orig);
71512         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71513         orig_conv.is_owned = false;
71514         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
71515         int64_t ret_ref = 0;
71516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71518         return ret_ref;
71519 }
71520
71521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71522         LDKAnchorDescriptor a_conv;
71523         a_conv.inner = untag_ptr(a);
71524         a_conv.is_owned = ptr_is_owned(a);
71525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71526         a_conv.is_owned = false;
71527         LDKAnchorDescriptor b_conv;
71528         b_conv.inner = untag_ptr(b);
71529         b_conv.is_owned = ptr_is_owned(b);
71530         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71531         b_conv.is_owned = false;
71532         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
71533         return ret_conv;
71534 }
71535
71536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
71537         LDKAnchorDescriptor this_arg_conv;
71538         this_arg_conv.inner = untag_ptr(this_arg);
71539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71541         this_arg_conv.is_owned = false;
71542         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
71543         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
71544         return tag_ptr(ret_ref, true);
71545 }
71546
71547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
71548         LDKAnchorDescriptor this_arg_conv;
71549         this_arg_conv.inner = untag_ptr(this_arg);
71550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71552         this_arg_conv.is_owned = false;
71553         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
71554         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
71555         return tag_ptr(ret_ref, true);
71556 }
71557
71558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
71559         LDKAnchorDescriptor this_arg_conv;
71560         this_arg_conv.inner = untag_ptr(this_arg);
71561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71563         this_arg_conv.is_owned = false;
71564         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
71565         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71566         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71567         CVec_u8Z_free(ret_var);
71568         return ret_arr;
71569 }
71570
71571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
71572         LDKAnchorDescriptor this_arg_conv;
71573         this_arg_conv.inner = untag_ptr(this_arg);
71574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71576         this_arg_conv.is_owned = false;
71577         LDKECDSASignature signature_ref;
71578         CHECK((*env)->GetArrayLength(env, signature) == 64);
71579         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
71580         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
71581         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71582         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71583         Witness_free(ret_var);
71584         return ret_arr;
71585 }
71586
71587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t signer_provider) {
71588         LDKAnchorDescriptor this_arg_conv;
71589         this_arg_conv.inner = untag_ptr(this_arg);
71590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71592         this_arg_conv.is_owned = false;
71593         void* signer_provider_ptr = untag_ptr(signer_provider);
71594         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
71595         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
71596         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
71597         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
71598         return tag_ptr(ret_ret, true);
71599 }
71600
71601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71602         LDKHTLCDescriptor this_obj_conv;
71603         this_obj_conv.inner = untag_ptr(this_obj);
71604         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71606         HTLCDescriptor_free(this_obj_conv);
71607 }
71608
71609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
71610         LDKHTLCDescriptor this_ptr_conv;
71611         this_ptr_conv.inner = untag_ptr(this_ptr);
71612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71614         this_ptr_conv.is_owned = false;
71615         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
71616         int64_t ret_ref = 0;
71617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71619         return ret_ref;
71620 }
71621
71622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71623         LDKHTLCDescriptor this_ptr_conv;
71624         this_ptr_conv.inner = untag_ptr(this_ptr);
71625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71627         this_ptr_conv.is_owned = false;
71628         LDKChannelDerivationParameters val_conv;
71629         val_conv.inner = untag_ptr(val);
71630         val_conv.is_owned = ptr_is_owned(val);
71631         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71632         val_conv = ChannelDerivationParameters_clone(&val_conv);
71633         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
71634 }
71635
71636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
71637         LDKHTLCDescriptor this_ptr_conv;
71638         this_ptr_conv.inner = untag_ptr(this_ptr);
71639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71641         this_ptr_conv.is_owned = false;
71642         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
71643         return ret_conv;
71644 }
71645
71646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71647         LDKHTLCDescriptor this_ptr_conv;
71648         this_ptr_conv.inner = untag_ptr(this_ptr);
71649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71651         this_ptr_conv.is_owned = false;
71652         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
71653 }
71654
71655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
71656         LDKHTLCDescriptor this_ptr_conv;
71657         this_ptr_conv.inner = untag_ptr(this_ptr);
71658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71660         this_ptr_conv.is_owned = false;
71661         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71662         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
71663         return ret_arr;
71664 }
71665
71666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71667         LDKHTLCDescriptor this_ptr_conv;
71668         this_ptr_conv.inner = untag_ptr(this_ptr);
71669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71671         this_ptr_conv.is_owned = false;
71672         LDKPublicKey val_ref;
71673         CHECK((*env)->GetArrayLength(env, val) == 33);
71674         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
71675         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
71676 }
71677
71678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
71679         LDKHTLCDescriptor this_ptr_conv;
71680         this_ptr_conv.inner = untag_ptr(this_ptr);
71681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71683         this_ptr_conv.is_owned = false;
71684         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
71685         int64_t ret_ref = 0;
71686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71688         return ret_ref;
71689 }
71690
71691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71692         LDKHTLCDescriptor this_ptr_conv;
71693         this_ptr_conv.inner = untag_ptr(this_ptr);
71694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71696         this_ptr_conv.is_owned = false;
71697         LDKHTLCOutputInCommitment val_conv;
71698         val_conv.inner = untag_ptr(val);
71699         val_conv.is_owned = ptr_is_owned(val);
71700         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71701         val_conv = HTLCOutputInCommitment_clone(&val_conv);
71702         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
71703 }
71704
71705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
71706         LDKHTLCDescriptor this_ptr_conv;
71707         this_ptr_conv.inner = untag_ptr(this_ptr);
71708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71710         this_ptr_conv.is_owned = false;
71711         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
71712         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
71713         int64_t ret_ref = tag_ptr(ret_copy, true);
71714         return ret_ref;
71715 }
71716
71717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71718         LDKHTLCDescriptor this_ptr_conv;
71719         this_ptr_conv.inner = untag_ptr(this_ptr);
71720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71722         this_ptr_conv.is_owned = false;
71723         void* val_ptr = untag_ptr(val);
71724         CHECK_ACCESS(val_ptr);
71725         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
71726         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
71727         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
71728 }
71729
71730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
71731         LDKHTLCDescriptor this_ptr_conv;
71732         this_ptr_conv.inner = untag_ptr(this_ptr);
71733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71735         this_ptr_conv.is_owned = false;
71736         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
71737         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
71738         return ret_arr;
71739 }
71740
71741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71742         LDKHTLCDescriptor this_ptr_conv;
71743         this_ptr_conv.inner = untag_ptr(this_ptr);
71744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71746         this_ptr_conv.is_owned = false;
71747         LDKECDSASignature val_ref;
71748         CHECK((*env)->GetArrayLength(env, val) == 64);
71749         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
71750         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
71751 }
71752
71753 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
71754         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
71755         int64_t ret_ref = 0;
71756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71758         return ret_ref;
71759 }
71760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71761         LDKHTLCDescriptor arg_conv;
71762         arg_conv.inner = untag_ptr(arg);
71763         arg_conv.is_owned = ptr_is_owned(arg);
71764         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71765         arg_conv.is_owned = false;
71766         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
71767         return ret_conv;
71768 }
71769
71770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71771         LDKHTLCDescriptor orig_conv;
71772         orig_conv.inner = untag_ptr(orig);
71773         orig_conv.is_owned = ptr_is_owned(orig);
71774         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71775         orig_conv.is_owned = false;
71776         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
71777         int64_t ret_ref = 0;
71778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71780         return ret_ref;
71781 }
71782
71783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71784         LDKHTLCDescriptor a_conv;
71785         a_conv.inner = untag_ptr(a);
71786         a_conv.is_owned = ptr_is_owned(a);
71787         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71788         a_conv.is_owned = false;
71789         LDKHTLCDescriptor b_conv;
71790         b_conv.inner = untag_ptr(b);
71791         b_conv.is_owned = ptr_is_owned(b);
71792         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71793         b_conv.is_owned = false;
71794         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
71795         return ret_conv;
71796 }
71797
71798 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
71799         LDKHTLCDescriptor obj_conv;
71800         obj_conv.inner = untag_ptr(obj);
71801         obj_conv.is_owned = ptr_is_owned(obj);
71802         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71803         obj_conv.is_owned = false;
71804         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
71805         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71806         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71807         CVec_u8Z_free(ret_var);
71808         return ret_arr;
71809 }
71810
71811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71812         LDKu8slice ser_ref;
71813         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71814         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71815         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
71816         *ret_conv = HTLCDescriptor_read(ser_ref);
71817         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71818         return tag_ptr(ret_conv, true);
71819 }
71820
71821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
71822         LDKHTLCDescriptor this_arg_conv;
71823         this_arg_conv.inner = untag_ptr(this_arg);
71824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71826         this_arg_conv.is_owned = false;
71827         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
71828         int64_t ret_ref = 0;
71829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71831         return ret_ref;
71832 }
71833
71834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
71835         LDKHTLCDescriptor this_arg_conv;
71836         this_arg_conv.inner = untag_ptr(this_arg);
71837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71839         this_arg_conv.is_owned = false;
71840         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
71841         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
71842         return tag_ptr(ret_ref, true);
71843 }
71844
71845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
71846         LDKHTLCDescriptor this_arg_conv;
71847         this_arg_conv.inner = untag_ptr(this_arg);
71848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71850         this_arg_conv.is_owned = false;
71851         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
71852         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
71853         return tag_ptr(ret_ref, true);
71854 }
71855
71856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
71857         LDKHTLCDescriptor this_arg_conv;
71858         this_arg_conv.inner = untag_ptr(this_arg);
71859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71861         this_arg_conv.is_owned = false;
71862         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
71863         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
71864         return tag_ptr(ret_ref, true);
71865 }
71866
71867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
71868         LDKHTLCDescriptor this_arg_conv;
71869         this_arg_conv.inner = untag_ptr(this_arg);
71870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71872         this_arg_conv.is_owned = false;
71873         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
71874         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71875         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71876         CVec_u8Z_free(ret_var);
71877         return ret_arr;
71878 }
71879
71880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature, int8_tArray witness_script) {
71881         LDKHTLCDescriptor this_arg_conv;
71882         this_arg_conv.inner = untag_ptr(this_arg);
71883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71885         this_arg_conv.is_owned = false;
71886         LDKECDSASignature signature_ref;
71887         CHECK((*env)->GetArrayLength(env, signature) == 64);
71888         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
71889         LDKu8slice witness_script_ref;
71890         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
71891         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
71892         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
71893         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71894         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71895         Witness_free(ret_var);
71896         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
71897         return ret_arr;
71898 }
71899
71900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t signer_provider) {
71901         LDKHTLCDescriptor this_arg_conv;
71902         this_arg_conv.inner = untag_ptr(this_arg);
71903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71905         this_arg_conv.is_owned = false;
71906         void* signer_provider_ptr = untag_ptr(signer_provider);
71907         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
71908         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
71909         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
71910         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
71911         return tag_ptr(ret_ret, true);
71912 }
71913
71914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71915         if (!ptr_is_owned(this_ptr)) return;
71916         void* this_ptr_ptr = untag_ptr(this_ptr);
71917         CHECK_ACCESS(this_ptr_ptr);
71918         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
71919         FREE(untag_ptr(this_ptr));
71920         BumpTransactionEvent_free(this_ptr_conv);
71921 }
71922
71923 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
71924         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
71925         *ret_copy = BumpTransactionEvent_clone(arg);
71926         int64_t ret_ref = tag_ptr(ret_copy, true);
71927         return ret_ref;
71928 }
71929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71930         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
71931         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
71932         return ret_conv;
71933 }
71934
71935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71936         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
71937         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
71938         *ret_copy = BumpTransactionEvent_clone(orig_conv);
71939         int64_t ret_ref = tag_ptr(ret_copy, true);
71940         return ret_ref;
71941 }
71942
71943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1channel_1close(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t package_target_feerate_sat_per_1000_weight, int8_tArray commitment_tx, int64_t commitment_tx_fee_satoshis, int64_t anchor_descriptor, int64_tArray pending_htlcs) {
71944         LDKThirtyTwoBytes claim_id_ref;
71945         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
71946         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
71947         LDKTransaction commitment_tx_ref;
71948         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
71949         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
71950         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
71951         commitment_tx_ref.data_is_owned = true;
71952         LDKAnchorDescriptor anchor_descriptor_conv;
71953         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
71954         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
71955         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
71956         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
71957         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
71958         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
71959         if (pending_htlcs_constr.datalen > 0)
71960                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
71961         else
71962                 pending_htlcs_constr.data = NULL;
71963         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
71964         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
71965                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
71966                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
71967                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
71968                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
71969                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
71970                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
71971                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
71972         }
71973         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
71974         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
71975         *ret_copy = BumpTransactionEvent_channel_close(claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
71976         int64_t ret_ref = tag_ptr(ret_copy, true);
71977         return ret_ref;
71978 }
71979
71980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1htlcresolution(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
71981         LDKThirtyTwoBytes claim_id_ref;
71982         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
71983         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
71984         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
71985         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
71986         if (htlc_descriptors_constr.datalen > 0)
71987                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
71988         else
71989                 htlc_descriptors_constr.data = NULL;
71990         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
71991         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
71992                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
71993                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
71994                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
71995                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
71996                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
71997                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
71998                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
71999         }
72000         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
72001         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
72002         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
72003         int64_t ret_ref = tag_ptr(ret_copy, true);
72004         return ret_ref;
72005 }
72006
72007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72008         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
72009         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
72010         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
72011         return ret_conv;
72012 }
72013
72014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72015         LDKInput this_obj_conv;
72016         this_obj_conv.inner = untag_ptr(this_obj);
72017         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72019         Input_free(this_obj_conv);
72020 }
72021
72022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72023         LDKInput this_ptr_conv;
72024         this_ptr_conv.inner = untag_ptr(this_ptr);
72025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72027         this_ptr_conv.is_owned = false;
72028         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
72029         int64_t ret_ref = 0;
72030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72032         return ret_ref;
72033 }
72034
72035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72036         LDKInput this_ptr_conv;
72037         this_ptr_conv.inner = untag_ptr(this_ptr);
72038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72040         this_ptr_conv.is_owned = false;
72041         LDKOutPoint val_conv;
72042         val_conv.inner = untag_ptr(val);
72043         val_conv.is_owned = ptr_is_owned(val);
72044         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72045         val_conv = OutPoint_clone(&val_conv);
72046         Input_set_outpoint(&this_ptr_conv, val_conv);
72047 }
72048
72049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
72050         LDKInput this_ptr_conv;
72051         this_ptr_conv.inner = untag_ptr(this_ptr);
72052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72054         this_ptr_conv.is_owned = false;
72055         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
72056         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
72057         return tag_ptr(ret_ref, true);
72058 }
72059
72060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72061         LDKInput this_ptr_conv;
72062         this_ptr_conv.inner = untag_ptr(this_ptr);
72063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72065         this_ptr_conv.is_owned = false;
72066         void* val_ptr = untag_ptr(val);
72067         CHECK_ACCESS(val_ptr);
72068         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
72069         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
72070         Input_set_previous_utxo(&this_ptr_conv, val_conv);
72071 }
72072
72073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
72074         LDKInput this_ptr_conv;
72075         this_ptr_conv.inner = untag_ptr(this_ptr);
72076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72078         this_ptr_conv.is_owned = false;
72079         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
72080         return ret_conv;
72081 }
72082
72083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72084         LDKInput this_ptr_conv;
72085         this_ptr_conv.inner = untag_ptr(this_ptr);
72086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72088         this_ptr_conv.is_owned = false;
72089         Input_set_satisfaction_weight(&this_ptr_conv, val);
72090 }
72091
72092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t previous_utxo_arg, int64_t satisfaction_weight_arg) {
72093         LDKOutPoint outpoint_arg_conv;
72094         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
72095         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
72096         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
72097         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
72098         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
72099         CHECK_ACCESS(previous_utxo_arg_ptr);
72100         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
72101         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
72102         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
72103         int64_t ret_ref = 0;
72104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72106         return ret_ref;
72107 }
72108
72109 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
72110         LDKInput ret_var = Input_clone(arg);
72111         int64_t ret_ref = 0;
72112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72114         return ret_ref;
72115 }
72116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72117         LDKInput arg_conv;
72118         arg_conv.inner = untag_ptr(arg);
72119         arg_conv.is_owned = ptr_is_owned(arg);
72120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72121         arg_conv.is_owned = false;
72122         int64_t ret_conv = Input_clone_ptr(&arg_conv);
72123         return ret_conv;
72124 }
72125
72126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72127         LDKInput orig_conv;
72128         orig_conv.inner = untag_ptr(orig);
72129         orig_conv.is_owned = ptr_is_owned(orig);
72130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72131         orig_conv.is_owned = false;
72132         LDKInput ret_var = Input_clone(&orig_conv);
72133         int64_t ret_ref = 0;
72134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72136         return ret_ref;
72137 }
72138
72139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
72140         LDKInput o_conv;
72141         o_conv.inner = untag_ptr(o);
72142         o_conv.is_owned = ptr_is_owned(o);
72143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72144         o_conv.is_owned = false;
72145         int64_t ret_conv = Input_hash(&o_conv);
72146         return ret_conv;
72147 }
72148
72149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72150         LDKInput a_conv;
72151         a_conv.inner = untag_ptr(a);
72152         a_conv.is_owned = ptr_is_owned(a);
72153         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72154         a_conv.is_owned = false;
72155         LDKInput b_conv;
72156         b_conv.inner = untag_ptr(b);
72157         b_conv.is_owned = ptr_is_owned(b);
72158         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72159         b_conv.is_owned = false;
72160         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
72161         return ret_conv;
72162 }
72163
72164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72165         LDKUtxo this_obj_conv;
72166         this_obj_conv.inner = untag_ptr(this_obj);
72167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72169         Utxo_free(this_obj_conv);
72170 }
72171
72172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72173         LDKUtxo this_ptr_conv;
72174         this_ptr_conv.inner = untag_ptr(this_ptr);
72175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72177         this_ptr_conv.is_owned = false;
72178         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
72179         int64_t ret_ref = 0;
72180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72182         return ret_ref;
72183 }
72184
72185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72186         LDKUtxo this_ptr_conv;
72187         this_ptr_conv.inner = untag_ptr(this_ptr);
72188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72190         this_ptr_conv.is_owned = false;
72191         LDKOutPoint val_conv;
72192         val_conv.inner = untag_ptr(val);
72193         val_conv.is_owned = ptr_is_owned(val);
72194         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72195         val_conv = OutPoint_clone(&val_conv);
72196         Utxo_set_outpoint(&this_ptr_conv, val_conv);
72197 }
72198
72199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
72200         LDKUtxo this_ptr_conv;
72201         this_ptr_conv.inner = untag_ptr(this_ptr);
72202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72204         this_ptr_conv.is_owned = false;
72205         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
72206         *ret_ref = Utxo_get_output(&this_ptr_conv);
72207         return tag_ptr(ret_ref, true);
72208 }
72209
72210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72211         LDKUtxo this_ptr_conv;
72212         this_ptr_conv.inner = untag_ptr(this_ptr);
72213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72215         this_ptr_conv.is_owned = false;
72216         void* val_ptr = untag_ptr(val);
72217         CHECK_ACCESS(val_ptr);
72218         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
72219         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
72220         Utxo_set_output(&this_ptr_conv, val_conv);
72221 }
72222
72223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
72224         LDKUtxo this_ptr_conv;
72225         this_ptr_conv.inner = untag_ptr(this_ptr);
72226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72228         this_ptr_conv.is_owned = false;
72229         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
72230         return ret_conv;
72231 }
72232
72233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72234         LDKUtxo this_ptr_conv;
72235         this_ptr_conv.inner = untag_ptr(this_ptr);
72236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72238         this_ptr_conv.is_owned = false;
72239         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
72240 }
72241
72242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int64_t satisfaction_weight_arg) {
72243         LDKOutPoint outpoint_arg_conv;
72244         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
72245         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
72246         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
72247         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
72248         void* output_arg_ptr = untag_ptr(output_arg);
72249         CHECK_ACCESS(output_arg_ptr);
72250         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
72251         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
72252         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
72253         int64_t ret_ref = 0;
72254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72256         return ret_ref;
72257 }
72258
72259 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
72260         LDKUtxo ret_var = Utxo_clone(arg);
72261         int64_t ret_ref = 0;
72262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72264         return ret_ref;
72265 }
72266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72267         LDKUtxo arg_conv;
72268         arg_conv.inner = untag_ptr(arg);
72269         arg_conv.is_owned = ptr_is_owned(arg);
72270         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72271         arg_conv.is_owned = false;
72272         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
72273         return ret_conv;
72274 }
72275
72276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72277         LDKUtxo orig_conv;
72278         orig_conv.inner = untag_ptr(orig);
72279         orig_conv.is_owned = ptr_is_owned(orig);
72280         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72281         orig_conv.is_owned = false;
72282         LDKUtxo ret_var = Utxo_clone(&orig_conv);
72283         int64_t ret_ref = 0;
72284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72286         return ret_ref;
72287 }
72288
72289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
72290         LDKUtxo o_conv;
72291         o_conv.inner = untag_ptr(o);
72292         o_conv.is_owned = ptr_is_owned(o);
72293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72294         o_conv.is_owned = false;
72295         int64_t ret_conv = Utxo_hash(&o_conv);
72296         return ret_conv;
72297 }
72298
72299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72300         LDKUtxo a_conv;
72301         a_conv.inner = untag_ptr(a);
72302         a_conv.is_owned = ptr_is_owned(a);
72303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72304         a_conv.is_owned = false;
72305         LDKUtxo b_conv;
72306         b_conv.inner = untag_ptr(b);
72307         b_conv.is_owned = ptr_is_owned(b);
72308         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72309         b_conv.is_owned = false;
72310         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
72311         return ret_conv;
72312 }
72313
72314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1new_1p2pkh(JNIEnv *env, jclass clz, int64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
72315         LDKOutPoint outpoint_conv;
72316         outpoint_conv.inner = untag_ptr(outpoint);
72317         outpoint_conv.is_owned = ptr_is_owned(outpoint);
72318         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
72319         outpoint_conv = OutPoint_clone(&outpoint_conv);
72320         uint8_t pubkey_hash_arr[20];
72321         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
72322         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
72323         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
72324         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
72325         int64_t ret_ref = 0;
72326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72328         return ret_ref;
72329 }
72330
72331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72332         LDKCoinSelection this_obj_conv;
72333         this_obj_conv.inner = untag_ptr(this_obj);
72334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72336         CoinSelection_free(this_obj_conv);
72337 }
72338
72339 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
72340         LDKCoinSelection this_ptr_conv;
72341         this_ptr_conv.inner = untag_ptr(this_ptr);
72342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72344         this_ptr_conv.is_owned = false;
72345         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
72346         int64_tArray ret_arr = NULL;
72347         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
72348         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
72349         for (size_t g = 0; g < ret_var.datalen; g++) {
72350                 LDKUtxo ret_conv_6_var = ret_var.data[g];
72351                 int64_t ret_conv_6_ref = 0;
72352                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
72353                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
72354                 ret_arr_ptr[g] = ret_conv_6_ref;
72355         }
72356         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
72357         FREE(ret_var.data);
72358         return ret_arr;
72359 }
72360
72361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
72362         LDKCoinSelection this_ptr_conv;
72363         this_ptr_conv.inner = untag_ptr(this_ptr);
72364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72366         this_ptr_conv.is_owned = false;
72367         LDKCVec_UtxoZ val_constr;
72368         val_constr.datalen = (*env)->GetArrayLength(env, val);
72369         if (val_constr.datalen > 0)
72370                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
72371         else
72372                 val_constr.data = NULL;
72373         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
72374         for (size_t g = 0; g < val_constr.datalen; g++) {
72375                 int64_t val_conv_6 = val_vals[g];
72376                 LDKUtxo val_conv_6_conv;
72377                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
72378                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
72379                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
72380                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
72381                 val_constr.data[g] = val_conv_6_conv;
72382         }
72383         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
72384         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
72385 }
72386
72387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
72388         LDKCoinSelection this_ptr_conv;
72389         this_ptr_conv.inner = untag_ptr(this_ptr);
72390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72392         this_ptr_conv.is_owned = false;
72393         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
72394         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
72395         int64_t ret_ref = tag_ptr(ret_copy, true);
72396         return ret_ref;
72397 }
72398
72399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72400         LDKCoinSelection this_ptr_conv;
72401         this_ptr_conv.inner = untag_ptr(this_ptr);
72402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72404         this_ptr_conv.is_owned = false;
72405         void* val_ptr = untag_ptr(val);
72406         CHECK_ACCESS(val_ptr);
72407         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
72408         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
72409         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
72410 }
72411
72412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1new(JNIEnv *env, jclass clz, int64_tArray confirmed_utxos_arg, int64_t change_output_arg) {
72413         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
72414         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
72415         if (confirmed_utxos_arg_constr.datalen > 0)
72416                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
72417         else
72418                 confirmed_utxos_arg_constr.data = NULL;
72419         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
72420         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
72421                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
72422                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
72423                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
72424                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
72425                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
72426                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
72427                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
72428         }
72429         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
72430         void* change_output_arg_ptr = untag_ptr(change_output_arg);
72431         CHECK_ACCESS(change_output_arg_ptr);
72432         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
72433         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
72434         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
72435         int64_t ret_ref = 0;
72436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72438         return ret_ref;
72439 }
72440
72441 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
72442         LDKCoinSelection ret_var = CoinSelection_clone(arg);
72443         int64_t ret_ref = 0;
72444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72446         return ret_ref;
72447 }
72448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72449         LDKCoinSelection arg_conv;
72450         arg_conv.inner = untag_ptr(arg);
72451         arg_conv.is_owned = ptr_is_owned(arg);
72452         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72453         arg_conv.is_owned = false;
72454         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
72455         return ret_conv;
72456 }
72457
72458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72459         LDKCoinSelection orig_conv;
72460         orig_conv.inner = untag_ptr(orig);
72461         orig_conv.is_owned = ptr_is_owned(orig);
72462         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72463         orig_conv.is_owned = false;
72464         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
72465         int64_t ret_ref = 0;
72466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72468         return ret_ref;
72469 }
72470
72471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72472         if (!ptr_is_owned(this_ptr)) return;
72473         void* this_ptr_ptr = untag_ptr(this_ptr);
72474         CHECK_ACCESS(this_ptr_ptr);
72475         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
72476         FREE(untag_ptr(this_ptr));
72477         CoinSelectionSource_free(this_ptr_conv);
72478 }
72479
72480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72481         if (!ptr_is_owned(this_ptr)) return;
72482         void* this_ptr_ptr = untag_ptr(this_ptr);
72483         CHECK_ACCESS(this_ptr_ptr);
72484         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
72485         FREE(untag_ptr(this_ptr));
72486         WalletSource_free(this_ptr_conv);
72487 }
72488
72489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72490         LDKWallet this_obj_conv;
72491         this_obj_conv.inner = untag_ptr(this_obj);
72492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72494         Wallet_free(this_obj_conv);
72495 }
72496
72497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
72498         void* source_ptr = untag_ptr(source);
72499         CHECK_ACCESS(source_ptr);
72500         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
72501         if (source_conv.free == LDKWalletSource_JCalls_free) {
72502                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72503                 LDKWalletSource_JCalls_cloned(&source_conv);
72504         }
72505         void* logger_ptr = untag_ptr(logger);
72506         CHECK_ACCESS(logger_ptr);
72507         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72508         if (logger_conv.free == LDKLogger_JCalls_free) {
72509                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72510                 LDKLogger_JCalls_cloned(&logger_conv);
72511         }
72512         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
72513         int64_t ret_ref = 0;
72514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72516         return ret_ref;
72517 }
72518
72519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
72520         LDKWallet this_arg_conv;
72521         this_arg_conv.inner = untag_ptr(this_arg);
72522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72524         this_arg_conv.is_owned = false;
72525         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
72526         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
72527         return tag_ptr(ret_ret, true);
72528 }
72529
72530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72531         LDKBumpTransactionEventHandler this_obj_conv;
72532         this_obj_conv.inner = untag_ptr(this_obj);
72533         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72535         BumpTransactionEventHandler_free(this_obj_conv);
72536 }
72537
72538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1new(JNIEnv *env, jclass clz, int64_t broadcaster, int64_t utxo_source, int64_t signer_provider, int64_t logger) {
72539         void* broadcaster_ptr = untag_ptr(broadcaster);
72540         CHECK_ACCESS(broadcaster_ptr);
72541         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
72542         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
72543                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72544                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
72545         }
72546         void* utxo_source_ptr = untag_ptr(utxo_source);
72547         CHECK_ACCESS(utxo_source_ptr);
72548         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
72549         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
72550                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72551                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
72552         }
72553         void* signer_provider_ptr = untag_ptr(signer_provider);
72554         CHECK_ACCESS(signer_provider_ptr);
72555         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
72556         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
72557                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72558                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
72559         }
72560         void* logger_ptr = untag_ptr(logger);
72561         CHECK_ACCESS(logger_ptr);
72562         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72563         if (logger_conv.free == LDKLogger_JCalls_free) {
72564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72565                 LDKLogger_JCalls_cloned(&logger_conv);
72566         }
72567         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
72568         int64_t ret_ref = 0;
72569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72571         return ret_ref;
72572 }
72573
72574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
72575         LDKBumpTransactionEventHandler this_arg_conv;
72576         this_arg_conv.inner = untag_ptr(this_arg);
72577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72579         this_arg_conv.is_owned = false;
72580         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
72581         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
72582 }
72583
72584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72585         LDKFilesystemStore this_obj_conv;
72586         this_obj_conv.inner = untag_ptr(this_obj);
72587         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72589         FilesystemStore_free(this_obj_conv);
72590 }
72591
72592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1new(JNIEnv *env, jclass clz, jstring data_dir) {
72593         LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
72594         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
72595         int64_t ret_ref = 0;
72596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72598         return ret_ref;
72599 }
72600
72601 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
72602         LDKFilesystemStore this_arg_conv;
72603         this_arg_conv.inner = untag_ptr(this_arg);
72604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72606         this_arg_conv.is_owned = false;
72607         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
72608         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
72609         Str_free(ret_str);
72610         return ret_conv;
72611 }
72612
72613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1as_1KVStore(JNIEnv *env, jclass clz, int64_t this_arg) {
72614         LDKFilesystemStore this_arg_conv;
72615         this_arg_conv.inner = untag_ptr(this_arg);
72616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72618         this_arg_conv.is_owned = false;
72619         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
72620         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
72621         return tag_ptr(ret_ret, true);
72622 }
72623
72624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72625         LDKBackgroundProcessor this_obj_conv;
72626         this_obj_conv.inner = untag_ptr(this_obj);
72627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72629         BackgroundProcessor_free(this_obj_conv);
72630 }
72631
72632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72633         if (!ptr_is_owned(this_ptr)) return;
72634         void* this_ptr_ptr = untag_ptr(this_ptr);
72635         CHECK_ACCESS(this_ptr_ptr);
72636         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
72637         FREE(untag_ptr(this_ptr));
72638         GossipSync_free(this_ptr_conv);
72639 }
72640
72641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
72642         LDKP2PGossipSync a_conv;
72643         a_conv.inner = untag_ptr(a);
72644         a_conv.is_owned = ptr_is_owned(a);
72645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72646         a_conv.is_owned = false;
72647         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
72648         *ret_copy = GossipSync_p2_p(&a_conv);
72649         int64_t ret_ref = tag_ptr(ret_copy, true);
72650         return ret_ref;
72651 }
72652
72653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
72654         LDKRapidGossipSync a_conv;
72655         a_conv.inner = untag_ptr(a);
72656         a_conv.is_owned = ptr_is_owned(a);
72657         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72658         a_conv.is_owned = false;
72659         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
72660         *ret_copy = GossipSync_rapid(&a_conv);
72661         int64_t ret_ref = tag_ptr(ret_copy, true);
72662         return ret_ref;
72663 }
72664
72665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
72666         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
72667         *ret_copy = GossipSync_none();
72668         int64_t ret_ref = tag_ptr(ret_copy, true);
72669         return ret_ref;
72670 }
72671
72672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t gossip_sync, int64_t peer_manager, int64_t logger, int64_t scorer) {
72673         void* persister_ptr = untag_ptr(persister);
72674         CHECK_ACCESS(persister_ptr);
72675         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
72676         if (persister_conv.free == LDKPersister_JCalls_free) {
72677                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72678                 LDKPersister_JCalls_cloned(&persister_conv);
72679         }
72680         void* event_handler_ptr = untag_ptr(event_handler);
72681         CHECK_ACCESS(event_handler_ptr);
72682         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
72683         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
72684                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72685                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
72686         }
72687         LDKChainMonitor chain_monitor_conv;
72688         chain_monitor_conv.inner = untag_ptr(chain_monitor);
72689         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
72690         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
72691         chain_monitor_conv.is_owned = false;
72692         LDKChannelManager channel_manager_conv;
72693         channel_manager_conv.inner = untag_ptr(channel_manager);
72694         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
72695         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
72696         channel_manager_conv.is_owned = false;
72697         void* gossip_sync_ptr = untag_ptr(gossip_sync);
72698         CHECK_ACCESS(gossip_sync_ptr);
72699         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
72700         // WARNING: we may need a move here but no clone is available for LDKGossipSync
72701         LDKPeerManager peer_manager_conv;
72702         peer_manager_conv.inner = untag_ptr(peer_manager);
72703         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
72704         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
72705         peer_manager_conv.is_owned = false;
72706         void* logger_ptr = untag_ptr(logger);
72707         CHECK_ACCESS(logger_ptr);
72708         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72709         if (logger_conv.free == LDKLogger_JCalls_free) {
72710                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72711                 LDKLogger_JCalls_cloned(&logger_conv);
72712         }
72713         void* scorer_ptr = untag_ptr(scorer);
72714         CHECK_ACCESS(scorer_ptr);
72715         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
72716         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
72717         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
72718                 // Manually implement clone for Java trait instances
72719                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
72720                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72721                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
72722                 }
72723         }
72724         LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, gossip_sync_conv, &peer_manager_conv, logger_conv, scorer_conv);
72725         int64_t ret_ref = 0;
72726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72728         return ret_ref;
72729 }
72730
72731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
72732         LDKBackgroundProcessor this_arg_conv;
72733         this_arg_conv.inner = untag_ptr(this_arg);
72734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72736         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
72737         
72738         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
72739         *ret_conv = BackgroundProcessor_join(this_arg_conv);
72740         return tag_ptr(ret_conv, true);
72741 }
72742
72743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
72744         LDKBackgroundProcessor this_arg_conv;
72745         this_arg_conv.inner = untag_ptr(this_arg);
72746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72748         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
72749         
72750         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
72751         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
72752         return tag_ptr(ret_conv, true);
72753 }
72754
72755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72756         if (!ptr_is_owned(this_ptr)) return;
72757         void* this_ptr_ptr = untag_ptr(this_ptr);
72758         CHECK_ACCESS(this_ptr_ptr);
72759         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
72760         FREE(untag_ptr(this_ptr));
72761         Bolt11ParseError_free(this_ptr_conv);
72762 }
72763
72764 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
72765         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72766         *ret_copy = Bolt11ParseError_clone(arg);
72767         int64_t ret_ref = tag_ptr(ret_copy, true);
72768         return ret_ref;
72769 }
72770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72771         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
72772         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
72773         return ret_conv;
72774 }
72775
72776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72777         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
72778         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72779         *ret_copy = Bolt11ParseError_clone(orig_conv);
72780         int64_t ret_ref = tag_ptr(ret_copy, true);
72781         return ret_ref;
72782 }
72783
72784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
72785         void* a_ptr = untag_ptr(a);
72786         CHECK_ACCESS(a_ptr);
72787         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
72788         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
72789         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72790         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
72791         int64_t ret_ref = tag_ptr(ret_copy, true);
72792         return ret_ref;
72793 }
72794
72795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
72796         
72797         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72798         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
72799         int64_t ret_ref = tag_ptr(ret_copy, true);
72800         return ret_ref;
72801 }
72802
72803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
72804         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
72805         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72806         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
72807         int64_t ret_ref = tag_ptr(ret_copy, true);
72808         return ret_ref;
72809 }
72810
72811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
72812         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72813         *ret_copy = Bolt11ParseError_bad_prefix();
72814         int64_t ret_ref = tag_ptr(ret_copy, true);
72815         return ret_ref;
72816 }
72817
72818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
72819         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72820         *ret_copy = Bolt11ParseError_unknown_currency();
72821         int64_t ret_ref = tag_ptr(ret_copy, true);
72822         return ret_ref;
72823 }
72824
72825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
72826         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72827         *ret_copy = Bolt11ParseError_unknown_si_prefix();
72828         int64_t ret_ref = tag_ptr(ret_copy, true);
72829         return ret_ref;
72830 }
72831
72832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
72833         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72834         *ret_copy = Bolt11ParseError_malformed_hrp();
72835         int64_t ret_ref = tag_ptr(ret_copy, true);
72836         return ret_ref;
72837 }
72838
72839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
72840         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72841         *ret_copy = Bolt11ParseError_too_short_data_part();
72842         int64_t ret_ref = tag_ptr(ret_copy, true);
72843         return ret_ref;
72844 }
72845
72846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
72847         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72848         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
72849         int64_t ret_ref = tag_ptr(ret_copy, true);
72850         return ret_ref;
72851 }
72852
72853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
72854         
72855         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72856         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
72857         int64_t ret_ref = tag_ptr(ret_copy, true);
72858         return ret_ref;
72859 }
72860
72861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
72862         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72863         *ret_copy = Bolt11ParseError_padding_error();
72864         int64_t ret_ref = tag_ptr(ret_copy, true);
72865         return ret_ref;
72866 }
72867
72868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
72869         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72870         *ret_copy = Bolt11ParseError_integer_overflow_error();
72871         int64_t ret_ref = tag_ptr(ret_copy, true);
72872         return ret_ref;
72873 }
72874
72875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
72876         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72877         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
72878         int64_t ret_ref = tag_ptr(ret_copy, true);
72879         return ret_ref;
72880 }
72881
72882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
72883         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72884         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
72885         int64_t ret_ref = tag_ptr(ret_copy, true);
72886         return ret_ref;
72887 }
72888
72889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
72890         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72891         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
72892         int64_t ret_ref = tag_ptr(ret_copy, true);
72893         return ret_ref;
72894 }
72895
72896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
72897         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72898         *ret_copy = Bolt11ParseError_invalid_recovery_id();
72899         int64_t ret_ref = tag_ptr(ret_copy, true);
72900         return ret_ref;
72901 }
72902
72903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
72904         LDKStr a_conv = java_to_owned_str(env, a);
72905         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72906         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
72907         int64_t ret_ref = tag_ptr(ret_copy, true);
72908         return ret_ref;
72909 }
72910
72911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
72912         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
72913         *ret_copy = Bolt11ParseError_skip();
72914         int64_t ret_ref = tag_ptr(ret_copy, true);
72915         return ret_ref;
72916 }
72917
72918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72919         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
72920         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
72921         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
72922         return ret_conv;
72923 }
72924
72925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72926         if (!ptr_is_owned(this_ptr)) return;
72927         void* this_ptr_ptr = untag_ptr(this_ptr);
72928         CHECK_ACCESS(this_ptr_ptr);
72929         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
72930         FREE(untag_ptr(this_ptr));
72931         ParseOrSemanticError_free(this_ptr_conv);
72932 }
72933
72934 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
72935         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
72936         *ret_copy = ParseOrSemanticError_clone(arg);
72937         int64_t ret_ref = tag_ptr(ret_copy, true);
72938         return ret_ref;
72939 }
72940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72941         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
72942         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
72943         return ret_conv;
72944 }
72945
72946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72947         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
72948         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
72949         *ret_copy = ParseOrSemanticError_clone(orig_conv);
72950         int64_t ret_ref = tag_ptr(ret_copy, true);
72951         return ret_ref;
72952 }
72953
72954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
72955         void* a_ptr = untag_ptr(a);
72956         CHECK_ACCESS(a_ptr);
72957         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
72958         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
72959         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
72960         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
72961         int64_t ret_ref = tag_ptr(ret_copy, true);
72962         return ret_ref;
72963 }
72964
72965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
72966         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
72967         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
72968         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
72969         int64_t ret_ref = tag_ptr(ret_copy, true);
72970         return ret_ref;
72971 }
72972
72973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72974         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
72975         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
72976         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
72977         return ret_conv;
72978 }
72979
72980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72981         LDKBolt11Invoice this_obj_conv;
72982         this_obj_conv.inner = untag_ptr(this_obj);
72983         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72985         Bolt11Invoice_free(this_obj_conv);
72986 }
72987
72988 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72989         LDKBolt11Invoice a_conv;
72990         a_conv.inner = untag_ptr(a);
72991         a_conv.is_owned = ptr_is_owned(a);
72992         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72993         a_conv.is_owned = false;
72994         LDKBolt11Invoice b_conv;
72995         b_conv.inner = untag_ptr(b);
72996         b_conv.is_owned = ptr_is_owned(b);
72997         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72998         b_conv.is_owned = false;
72999         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
73000         return ret_conv;
73001 }
73002
73003 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
73004         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
73005         int64_t ret_ref = 0;
73006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73008         return ret_ref;
73009 }
73010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73011         LDKBolt11Invoice arg_conv;
73012         arg_conv.inner = untag_ptr(arg);
73013         arg_conv.is_owned = ptr_is_owned(arg);
73014         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73015         arg_conv.is_owned = false;
73016         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
73017         return ret_conv;
73018 }
73019
73020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73021         LDKBolt11Invoice orig_conv;
73022         orig_conv.inner = untag_ptr(orig);
73023         orig_conv.is_owned = ptr_is_owned(orig);
73024         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73025         orig_conv.is_owned = false;
73026         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
73027         int64_t ret_ref = 0;
73028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73030         return ret_ref;
73031 }
73032
73033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73034         LDKBolt11Invoice o_conv;
73035         o_conv.inner = untag_ptr(o);
73036         o_conv.is_owned = ptr_is_owned(o);
73037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73038         o_conv.is_owned = false;
73039         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
73040         return ret_conv;
73041 }
73042
73043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73044         LDKSignedRawBolt11Invoice this_obj_conv;
73045         this_obj_conv.inner = untag_ptr(this_obj);
73046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73048         SignedRawBolt11Invoice_free(this_obj_conv);
73049 }
73050
73051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73052         LDKSignedRawBolt11Invoice a_conv;
73053         a_conv.inner = untag_ptr(a);
73054         a_conv.is_owned = ptr_is_owned(a);
73055         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73056         a_conv.is_owned = false;
73057         LDKSignedRawBolt11Invoice b_conv;
73058         b_conv.inner = untag_ptr(b);
73059         b_conv.is_owned = ptr_is_owned(b);
73060         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73061         b_conv.is_owned = false;
73062         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
73063         return ret_conv;
73064 }
73065
73066 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
73067         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
73068         int64_t ret_ref = 0;
73069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73071         return ret_ref;
73072 }
73073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73074         LDKSignedRawBolt11Invoice arg_conv;
73075         arg_conv.inner = untag_ptr(arg);
73076         arg_conv.is_owned = ptr_is_owned(arg);
73077         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73078         arg_conv.is_owned = false;
73079         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
73080         return ret_conv;
73081 }
73082
73083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73084         LDKSignedRawBolt11Invoice orig_conv;
73085         orig_conv.inner = untag_ptr(orig);
73086         orig_conv.is_owned = ptr_is_owned(orig);
73087         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73088         orig_conv.is_owned = false;
73089         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
73090         int64_t ret_ref = 0;
73091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73093         return ret_ref;
73094 }
73095
73096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73097         LDKSignedRawBolt11Invoice o_conv;
73098         o_conv.inner = untag_ptr(o);
73099         o_conv.is_owned = ptr_is_owned(o);
73100         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73101         o_conv.is_owned = false;
73102         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
73103         return ret_conv;
73104 }
73105
73106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73107         LDKRawBolt11Invoice this_obj_conv;
73108         this_obj_conv.inner = untag_ptr(this_obj);
73109         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73111         RawBolt11Invoice_free(this_obj_conv);
73112 }
73113
73114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
73115         LDKRawBolt11Invoice this_ptr_conv;
73116         this_ptr_conv.inner = untag_ptr(this_ptr);
73117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73119         this_ptr_conv.is_owned = false;
73120         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
73121         int64_t ret_ref = 0;
73122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73124         return ret_ref;
73125 }
73126
73127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73128         LDKRawBolt11Invoice this_ptr_conv;
73129         this_ptr_conv.inner = untag_ptr(this_ptr);
73130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73132         this_ptr_conv.is_owned = false;
73133         LDKRawDataPart val_conv;
73134         val_conv.inner = untag_ptr(val);
73135         val_conv.is_owned = ptr_is_owned(val);
73136         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73137         val_conv = RawDataPart_clone(&val_conv);
73138         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
73139 }
73140
73141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73142         LDKRawBolt11Invoice a_conv;
73143         a_conv.inner = untag_ptr(a);
73144         a_conv.is_owned = ptr_is_owned(a);
73145         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73146         a_conv.is_owned = false;
73147         LDKRawBolt11Invoice b_conv;
73148         b_conv.inner = untag_ptr(b);
73149         b_conv.is_owned = ptr_is_owned(b);
73150         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73151         b_conv.is_owned = false;
73152         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
73153         return ret_conv;
73154 }
73155
73156 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
73157         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
73158         int64_t ret_ref = 0;
73159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73161         return ret_ref;
73162 }
73163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73164         LDKRawBolt11Invoice arg_conv;
73165         arg_conv.inner = untag_ptr(arg);
73166         arg_conv.is_owned = ptr_is_owned(arg);
73167         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73168         arg_conv.is_owned = false;
73169         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
73170         return ret_conv;
73171 }
73172
73173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73174         LDKRawBolt11Invoice orig_conv;
73175         orig_conv.inner = untag_ptr(orig);
73176         orig_conv.is_owned = ptr_is_owned(orig);
73177         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73178         orig_conv.is_owned = false;
73179         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
73180         int64_t ret_ref = 0;
73181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73183         return ret_ref;
73184 }
73185
73186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73187         LDKRawBolt11Invoice o_conv;
73188         o_conv.inner = untag_ptr(o);
73189         o_conv.is_owned = ptr_is_owned(o);
73190         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73191         o_conv.is_owned = false;
73192         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
73193         return ret_conv;
73194 }
73195
73196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73197         LDKRawDataPart this_obj_conv;
73198         this_obj_conv.inner = untag_ptr(this_obj);
73199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73201         RawDataPart_free(this_obj_conv);
73202 }
73203
73204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
73205         LDKRawDataPart this_ptr_conv;
73206         this_ptr_conv.inner = untag_ptr(this_ptr);
73207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73209         this_ptr_conv.is_owned = false;
73210         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
73211         int64_t ret_ref = 0;
73212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73214         return ret_ref;
73215 }
73216
73217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73218         LDKRawDataPart this_ptr_conv;
73219         this_ptr_conv.inner = untag_ptr(this_ptr);
73220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73222         this_ptr_conv.is_owned = false;
73223         LDKPositiveTimestamp val_conv;
73224         val_conv.inner = untag_ptr(val);
73225         val_conv.is_owned = ptr_is_owned(val);
73226         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73227         val_conv = PositiveTimestamp_clone(&val_conv);
73228         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
73229 }
73230
73231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73232         LDKRawDataPart a_conv;
73233         a_conv.inner = untag_ptr(a);
73234         a_conv.is_owned = ptr_is_owned(a);
73235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73236         a_conv.is_owned = false;
73237         LDKRawDataPart b_conv;
73238         b_conv.inner = untag_ptr(b);
73239         b_conv.is_owned = ptr_is_owned(b);
73240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73241         b_conv.is_owned = false;
73242         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
73243         return ret_conv;
73244 }
73245
73246 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
73247         LDKRawDataPart ret_var = RawDataPart_clone(arg);
73248         int64_t ret_ref = 0;
73249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73251         return ret_ref;
73252 }
73253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73254         LDKRawDataPart arg_conv;
73255         arg_conv.inner = untag_ptr(arg);
73256         arg_conv.is_owned = ptr_is_owned(arg);
73257         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73258         arg_conv.is_owned = false;
73259         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
73260         return ret_conv;
73261 }
73262
73263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73264         LDKRawDataPart orig_conv;
73265         orig_conv.inner = untag_ptr(orig);
73266         orig_conv.is_owned = ptr_is_owned(orig);
73267         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73268         orig_conv.is_owned = false;
73269         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
73270         int64_t ret_ref = 0;
73271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73273         return ret_ref;
73274 }
73275
73276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
73277         LDKRawDataPart o_conv;
73278         o_conv.inner = untag_ptr(o);
73279         o_conv.is_owned = ptr_is_owned(o);
73280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73281         o_conv.is_owned = false;
73282         int64_t ret_conv = RawDataPart_hash(&o_conv);
73283         return ret_conv;
73284 }
73285
73286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73287         LDKPositiveTimestamp this_obj_conv;
73288         this_obj_conv.inner = untag_ptr(this_obj);
73289         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73291         PositiveTimestamp_free(this_obj_conv);
73292 }
73293
73294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73295         LDKPositiveTimestamp a_conv;
73296         a_conv.inner = untag_ptr(a);
73297         a_conv.is_owned = ptr_is_owned(a);
73298         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73299         a_conv.is_owned = false;
73300         LDKPositiveTimestamp b_conv;
73301         b_conv.inner = untag_ptr(b);
73302         b_conv.is_owned = ptr_is_owned(b);
73303         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73304         b_conv.is_owned = false;
73305         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
73306         return ret_conv;
73307 }
73308
73309 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
73310         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
73311         int64_t ret_ref = 0;
73312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73314         return ret_ref;
73315 }
73316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73317         LDKPositiveTimestamp arg_conv;
73318         arg_conv.inner = untag_ptr(arg);
73319         arg_conv.is_owned = ptr_is_owned(arg);
73320         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73321         arg_conv.is_owned = false;
73322         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
73323         return ret_conv;
73324 }
73325
73326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73327         LDKPositiveTimestamp orig_conv;
73328         orig_conv.inner = untag_ptr(orig);
73329         orig_conv.is_owned = ptr_is_owned(orig);
73330         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73331         orig_conv.is_owned = false;
73332         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
73333         int64_t ret_ref = 0;
73334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73336         return ret_ref;
73337 }
73338
73339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
73340         LDKPositiveTimestamp o_conv;
73341         o_conv.inner = untag_ptr(o);
73342         o_conv.is_owned = ptr_is_owned(o);
73343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73344         o_conv.is_owned = false;
73345         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
73346         return ret_conv;
73347 }
73348
73349 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73350         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
73351         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
73352         return ret_conv;
73353 }
73354
73355 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
73356         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
73357         return ret_conv;
73358 }
73359
73360 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
73361         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
73362         return ret_conv;
73363 }
73364
73365 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
73366         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
73367         return ret_conv;
73368 }
73369
73370 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
73371         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
73372         return ret_conv;
73373 }
73374
73375 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73376         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
73377         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
73378         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
73379         return ret_conv;
73380 }
73381
73382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
73383         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
73384         int64_t ret_conv = SiPrefix_hash(o_conv);
73385         return ret_conv;
73386 }
73387
73388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
73389         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
73390         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
73391         return ret_conv;
73392 }
73393
73394 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73395         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
73396         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
73397         return ret_conv;
73398 }
73399
73400 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
73401         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
73402         return ret_conv;
73403 }
73404
73405 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
73406         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
73407         return ret_conv;
73408 }
73409
73410 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
73411         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
73412         return ret_conv;
73413 }
73414
73415 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
73416         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
73417         return ret_conv;
73418 }
73419
73420 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
73421         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
73422         return ret_conv;
73423 }
73424
73425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
73426         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
73427         int64_t ret_conv = Currency_hash(o_conv);
73428         return ret_conv;
73429 }
73430
73431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73432         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
73433         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
73434         jboolean ret_conv = Currency_eq(a_conv, b_conv);
73435         return ret_conv;
73436 }
73437
73438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73439         LDKSha256 this_obj_conv;
73440         this_obj_conv.inner = untag_ptr(this_obj);
73441         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73443         Sha256_free(this_obj_conv);
73444 }
73445
73446 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
73447         LDKSha256 ret_var = Sha256_clone(arg);
73448         int64_t ret_ref = 0;
73449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73451         return ret_ref;
73452 }
73453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73454         LDKSha256 arg_conv;
73455         arg_conv.inner = untag_ptr(arg);
73456         arg_conv.is_owned = ptr_is_owned(arg);
73457         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73458         arg_conv.is_owned = false;
73459         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
73460         return ret_conv;
73461 }
73462
73463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73464         LDKSha256 orig_conv;
73465         orig_conv.inner = untag_ptr(orig);
73466         orig_conv.is_owned = ptr_is_owned(orig);
73467         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73468         orig_conv.is_owned = false;
73469         LDKSha256 ret_var = Sha256_clone(&orig_conv);
73470         int64_t ret_ref = 0;
73471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73473         return ret_ref;
73474 }
73475
73476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
73477         LDKSha256 o_conv;
73478         o_conv.inner = untag_ptr(o);
73479         o_conv.is_owned = ptr_is_owned(o);
73480         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73481         o_conv.is_owned = false;
73482         int64_t ret_conv = Sha256_hash(&o_conv);
73483         return ret_conv;
73484 }
73485
73486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73487         LDKSha256 a_conv;
73488         a_conv.inner = untag_ptr(a);
73489         a_conv.is_owned = ptr_is_owned(a);
73490         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73491         a_conv.is_owned = false;
73492         LDKSha256 b_conv;
73493         b_conv.inner = untag_ptr(b);
73494         b_conv.is_owned = ptr_is_owned(b);
73495         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73496         b_conv.is_owned = false;
73497         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
73498         return ret_conv;
73499 }
73500
73501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
73502         uint8_t bytes_arr[32];
73503         CHECK((*env)->GetArrayLength(env, bytes) == 32);
73504         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
73505         uint8_t (*bytes_ref)[32] = &bytes_arr;
73506         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
73507         int64_t ret_ref = 0;
73508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73510         return ret_ref;
73511 }
73512
73513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73514         LDKDescription this_obj_conv;
73515         this_obj_conv.inner = untag_ptr(this_obj);
73516         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73518         Description_free(this_obj_conv);
73519 }
73520
73521 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
73522         LDKDescription ret_var = Description_clone(arg);
73523         int64_t ret_ref = 0;
73524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73526         return ret_ref;
73527 }
73528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73529         LDKDescription arg_conv;
73530         arg_conv.inner = untag_ptr(arg);
73531         arg_conv.is_owned = ptr_is_owned(arg);
73532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73533         arg_conv.is_owned = false;
73534         int64_t ret_conv = Description_clone_ptr(&arg_conv);
73535         return ret_conv;
73536 }
73537
73538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73539         LDKDescription orig_conv;
73540         orig_conv.inner = untag_ptr(orig);
73541         orig_conv.is_owned = ptr_is_owned(orig);
73542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73543         orig_conv.is_owned = false;
73544         LDKDescription ret_var = Description_clone(&orig_conv);
73545         int64_t ret_ref = 0;
73546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73548         return ret_ref;
73549 }
73550
73551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
73552         LDKDescription o_conv;
73553         o_conv.inner = untag_ptr(o);
73554         o_conv.is_owned = ptr_is_owned(o);
73555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73556         o_conv.is_owned = false;
73557         int64_t ret_conv = Description_hash(&o_conv);
73558         return ret_conv;
73559 }
73560
73561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73562         LDKDescription a_conv;
73563         a_conv.inner = untag_ptr(a);
73564         a_conv.is_owned = ptr_is_owned(a);
73565         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73566         a_conv.is_owned = false;
73567         LDKDescription b_conv;
73568         b_conv.inner = untag_ptr(b);
73569         b_conv.is_owned = ptr_is_owned(b);
73570         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73571         b_conv.is_owned = false;
73572         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
73573         return ret_conv;
73574 }
73575
73576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73577         LDKPayeePubKey this_obj_conv;
73578         this_obj_conv.inner = untag_ptr(this_obj);
73579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73581         PayeePubKey_free(this_obj_conv);
73582 }
73583
73584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
73585         LDKPayeePubKey this_ptr_conv;
73586         this_ptr_conv.inner = untag_ptr(this_ptr);
73587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73589         this_ptr_conv.is_owned = false;
73590         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73591         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
73592         return ret_arr;
73593 }
73594
73595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73596         LDKPayeePubKey this_ptr_conv;
73597         this_ptr_conv.inner = untag_ptr(this_ptr);
73598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73600         this_ptr_conv.is_owned = false;
73601         LDKPublicKey val_ref;
73602         CHECK((*env)->GetArrayLength(env, val) == 33);
73603         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
73604         PayeePubKey_set_a(&this_ptr_conv, val_ref);
73605 }
73606
73607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
73608         LDKPublicKey a_arg_ref;
73609         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
73610         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
73611         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
73612         int64_t ret_ref = 0;
73613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73615         return ret_ref;
73616 }
73617
73618 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
73619         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
73620         int64_t ret_ref = 0;
73621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73623         return ret_ref;
73624 }
73625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73626         LDKPayeePubKey arg_conv;
73627         arg_conv.inner = untag_ptr(arg);
73628         arg_conv.is_owned = ptr_is_owned(arg);
73629         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73630         arg_conv.is_owned = false;
73631         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
73632         return ret_conv;
73633 }
73634
73635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73636         LDKPayeePubKey orig_conv;
73637         orig_conv.inner = untag_ptr(orig);
73638         orig_conv.is_owned = ptr_is_owned(orig);
73639         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73640         orig_conv.is_owned = false;
73641         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
73642         int64_t ret_ref = 0;
73643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73645         return ret_ref;
73646 }
73647
73648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
73649         LDKPayeePubKey o_conv;
73650         o_conv.inner = untag_ptr(o);
73651         o_conv.is_owned = ptr_is_owned(o);
73652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73653         o_conv.is_owned = false;
73654         int64_t ret_conv = PayeePubKey_hash(&o_conv);
73655         return ret_conv;
73656 }
73657
73658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73659         LDKPayeePubKey a_conv;
73660         a_conv.inner = untag_ptr(a);
73661         a_conv.is_owned = ptr_is_owned(a);
73662         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73663         a_conv.is_owned = false;
73664         LDKPayeePubKey b_conv;
73665         b_conv.inner = untag_ptr(b);
73666         b_conv.is_owned = ptr_is_owned(b);
73667         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73668         b_conv.is_owned = false;
73669         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
73670         return ret_conv;
73671 }
73672
73673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73674         LDKExpiryTime this_obj_conv;
73675         this_obj_conv.inner = untag_ptr(this_obj);
73676         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73678         ExpiryTime_free(this_obj_conv);
73679 }
73680
73681 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
73682         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
73683         int64_t ret_ref = 0;
73684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73686         return ret_ref;
73687 }
73688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73689         LDKExpiryTime arg_conv;
73690         arg_conv.inner = untag_ptr(arg);
73691         arg_conv.is_owned = ptr_is_owned(arg);
73692         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73693         arg_conv.is_owned = false;
73694         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
73695         return ret_conv;
73696 }
73697
73698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73699         LDKExpiryTime orig_conv;
73700         orig_conv.inner = untag_ptr(orig);
73701         orig_conv.is_owned = ptr_is_owned(orig);
73702         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73703         orig_conv.is_owned = false;
73704         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
73705         int64_t ret_ref = 0;
73706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73708         return ret_ref;
73709 }
73710
73711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
73712         LDKExpiryTime o_conv;
73713         o_conv.inner = untag_ptr(o);
73714         o_conv.is_owned = ptr_is_owned(o);
73715         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73716         o_conv.is_owned = false;
73717         int64_t ret_conv = ExpiryTime_hash(&o_conv);
73718         return ret_conv;
73719 }
73720
73721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73722         LDKExpiryTime a_conv;
73723         a_conv.inner = untag_ptr(a);
73724         a_conv.is_owned = ptr_is_owned(a);
73725         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73726         a_conv.is_owned = false;
73727         LDKExpiryTime b_conv;
73728         b_conv.inner = untag_ptr(b);
73729         b_conv.is_owned = ptr_is_owned(b);
73730         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73731         b_conv.is_owned = false;
73732         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
73733         return ret_conv;
73734 }
73735
73736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73737         LDKMinFinalCltvExpiryDelta this_obj_conv;
73738         this_obj_conv.inner = untag_ptr(this_obj);
73739         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73741         MinFinalCltvExpiryDelta_free(this_obj_conv);
73742 }
73743
73744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
73745         LDKMinFinalCltvExpiryDelta this_ptr_conv;
73746         this_ptr_conv.inner = untag_ptr(this_ptr);
73747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73749         this_ptr_conv.is_owned = false;
73750         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
73751         return ret_conv;
73752 }
73753
73754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73755         LDKMinFinalCltvExpiryDelta this_ptr_conv;
73756         this_ptr_conv.inner = untag_ptr(this_ptr);
73757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73759         this_ptr_conv.is_owned = false;
73760         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
73761 }
73762
73763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
73764         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
73765         int64_t ret_ref = 0;
73766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73768         return ret_ref;
73769 }
73770
73771 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
73772         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
73773         int64_t ret_ref = 0;
73774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73776         return ret_ref;
73777 }
73778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73779         LDKMinFinalCltvExpiryDelta arg_conv;
73780         arg_conv.inner = untag_ptr(arg);
73781         arg_conv.is_owned = ptr_is_owned(arg);
73782         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73783         arg_conv.is_owned = false;
73784         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
73785         return ret_conv;
73786 }
73787
73788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73789         LDKMinFinalCltvExpiryDelta orig_conv;
73790         orig_conv.inner = untag_ptr(orig);
73791         orig_conv.is_owned = ptr_is_owned(orig);
73792         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73793         orig_conv.is_owned = false;
73794         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
73795         int64_t ret_ref = 0;
73796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73798         return ret_ref;
73799 }
73800
73801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
73802         LDKMinFinalCltvExpiryDelta o_conv;
73803         o_conv.inner = untag_ptr(o);
73804         o_conv.is_owned = ptr_is_owned(o);
73805         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73806         o_conv.is_owned = false;
73807         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
73808         return ret_conv;
73809 }
73810
73811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73812         LDKMinFinalCltvExpiryDelta a_conv;
73813         a_conv.inner = untag_ptr(a);
73814         a_conv.is_owned = ptr_is_owned(a);
73815         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73816         a_conv.is_owned = false;
73817         LDKMinFinalCltvExpiryDelta b_conv;
73818         b_conv.inner = untag_ptr(b);
73819         b_conv.is_owned = ptr_is_owned(b);
73820         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73821         b_conv.is_owned = false;
73822         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
73823         return ret_conv;
73824 }
73825
73826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73827         if (!ptr_is_owned(this_ptr)) return;
73828         void* this_ptr_ptr = untag_ptr(this_ptr);
73829         CHECK_ACCESS(this_ptr_ptr);
73830         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
73831         FREE(untag_ptr(this_ptr));
73832         Fallback_free(this_ptr_conv);
73833 }
73834
73835 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
73836         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73837         *ret_copy = Fallback_clone(arg);
73838         int64_t ret_ref = tag_ptr(ret_copy, true);
73839         return ret_ref;
73840 }
73841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73842         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
73843         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
73844         return ret_conv;
73845 }
73846
73847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73848         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
73849         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73850         *ret_copy = Fallback_clone(orig_conv);
73851         int64_t ret_ref = tag_ptr(ret_copy, true);
73852         return ret_ref;
73853 }
73854
73855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
73856         
73857         LDKCVec_u8Z program_ref;
73858         program_ref.datalen = (*env)->GetArrayLength(env, program);
73859         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
73860         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
73861         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73862         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
73863         int64_t ret_ref = tag_ptr(ret_copy, true);
73864         return ret_ref;
73865 }
73866
73867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
73868         LDKTwentyBytes a_ref;
73869         CHECK((*env)->GetArrayLength(env, a) == 20);
73870         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
73871         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73872         *ret_copy = Fallback_pub_key_hash(a_ref);
73873         int64_t ret_ref = tag_ptr(ret_copy, true);
73874         return ret_ref;
73875 }
73876
73877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
73878         LDKTwentyBytes a_ref;
73879         CHECK((*env)->GetArrayLength(env, a) == 20);
73880         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
73881         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
73882         *ret_copy = Fallback_script_hash(a_ref);
73883         int64_t ret_ref = tag_ptr(ret_copy, true);
73884         return ret_ref;
73885 }
73886
73887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
73888         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
73889         int64_t ret_conv = Fallback_hash(o_conv);
73890         return ret_conv;
73891 }
73892
73893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73894         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
73895         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
73896         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
73897         return ret_conv;
73898 }
73899
73900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73901         LDKBolt11InvoiceSignature this_obj_conv;
73902         this_obj_conv.inner = untag_ptr(this_obj);
73903         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73905         Bolt11InvoiceSignature_free(this_obj_conv);
73906 }
73907
73908 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
73909         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
73910         int64_t ret_ref = 0;
73911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73913         return ret_ref;
73914 }
73915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73916         LDKBolt11InvoiceSignature arg_conv;
73917         arg_conv.inner = untag_ptr(arg);
73918         arg_conv.is_owned = ptr_is_owned(arg);
73919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73920         arg_conv.is_owned = false;
73921         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
73922         return ret_conv;
73923 }
73924
73925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73926         LDKBolt11InvoiceSignature orig_conv;
73927         orig_conv.inner = untag_ptr(orig);
73928         orig_conv.is_owned = ptr_is_owned(orig);
73929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73930         orig_conv.is_owned = false;
73931         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
73932         int64_t ret_ref = 0;
73933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73935         return ret_ref;
73936 }
73937
73938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
73939         LDKBolt11InvoiceSignature o_conv;
73940         o_conv.inner = untag_ptr(o);
73941         o_conv.is_owned = ptr_is_owned(o);
73942         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73943         o_conv.is_owned = false;
73944         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
73945         return ret_conv;
73946 }
73947
73948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73949         LDKBolt11InvoiceSignature a_conv;
73950         a_conv.inner = untag_ptr(a);
73951         a_conv.is_owned = ptr_is_owned(a);
73952         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73953         a_conv.is_owned = false;
73954         LDKBolt11InvoiceSignature b_conv;
73955         b_conv.inner = untag_ptr(b);
73956         b_conv.is_owned = ptr_is_owned(b);
73957         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73958         b_conv.is_owned = false;
73959         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
73960         return ret_conv;
73961 }
73962
73963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73964         LDKPrivateRoute this_obj_conv;
73965         this_obj_conv.inner = untag_ptr(this_obj);
73966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73968         PrivateRoute_free(this_obj_conv);
73969 }
73970
73971 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
73972         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
73973         int64_t ret_ref = 0;
73974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73976         return ret_ref;
73977 }
73978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73979         LDKPrivateRoute arg_conv;
73980         arg_conv.inner = untag_ptr(arg);
73981         arg_conv.is_owned = ptr_is_owned(arg);
73982         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73983         arg_conv.is_owned = false;
73984         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
73985         return ret_conv;
73986 }
73987
73988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73989         LDKPrivateRoute orig_conv;
73990         orig_conv.inner = untag_ptr(orig);
73991         orig_conv.is_owned = ptr_is_owned(orig);
73992         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73993         orig_conv.is_owned = false;
73994         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
73995         int64_t ret_ref = 0;
73996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73998         return ret_ref;
73999 }
74000
74001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
74002         LDKPrivateRoute o_conv;
74003         o_conv.inner = untag_ptr(o);
74004         o_conv.is_owned = ptr_is_owned(o);
74005         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74006         o_conv.is_owned = false;
74007         int64_t ret_conv = PrivateRoute_hash(&o_conv);
74008         return ret_conv;
74009 }
74010
74011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74012         LDKPrivateRoute a_conv;
74013         a_conv.inner = untag_ptr(a);
74014         a_conv.is_owned = ptr_is_owned(a);
74015         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74016         a_conv.is_owned = false;
74017         LDKPrivateRoute b_conv;
74018         b_conv.inner = untag_ptr(b);
74019         b_conv.is_owned = ptr_is_owned(b);
74020         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74021         b_conv.is_owned = false;
74022         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
74023         return ret_conv;
74024 }
74025
74026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
74027         LDKSignedRawBolt11Invoice this_arg_conv;
74028         this_arg_conv.inner = untag_ptr(this_arg);
74029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74031         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
74032         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
74033         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
74034         return tag_ptr(ret_conv, true);
74035 }
74036
74037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
74038         LDKSignedRawBolt11Invoice this_arg_conv;
74039         this_arg_conv.inner = untag_ptr(this_arg);
74040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74042         this_arg_conv.is_owned = false;
74043         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
74044         int64_t ret_ref = 0;
74045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74047         return ret_ref;
74048 }
74049
74050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74051         LDKSignedRawBolt11Invoice this_arg_conv;
74052         this_arg_conv.inner = untag_ptr(this_arg);
74053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74055         this_arg_conv.is_owned = false;
74056         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74057         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
74058         return ret_arr;
74059 }
74060
74061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74062         LDKSignedRawBolt11Invoice this_arg_conv;
74063         this_arg_conv.inner = untag_ptr(this_arg);
74064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74066         this_arg_conv.is_owned = false;
74067         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
74068         int64_t ret_ref = 0;
74069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74071         return ret_ref;
74072 }
74073
74074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74075         LDKSignedRawBolt11Invoice this_arg_conv;
74076         this_arg_conv.inner = untag_ptr(this_arg);
74077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74079         this_arg_conv.is_owned = false;
74080         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
74081         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
74082         return tag_ptr(ret_conv, true);
74083 }
74084
74085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74086         LDKSignedRawBolt11Invoice this_arg_conv;
74087         this_arg_conv.inner = untag_ptr(this_arg);
74088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74090         this_arg_conv.is_owned = false;
74091         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
74092         return ret_conv;
74093 }
74094
74095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74096         LDKRawBolt11Invoice this_arg_conv;
74097         this_arg_conv.inner = untag_ptr(this_arg);
74098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74100         this_arg_conv.is_owned = false;
74101         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74102         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
74103         return ret_arr;
74104 }
74105
74106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74107         LDKRawBolt11Invoice this_arg_conv;
74108         this_arg_conv.inner = untag_ptr(this_arg);
74109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74111         this_arg_conv.is_owned = false;
74112         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
74113         int64_t ret_ref = 0;
74114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74116         return ret_ref;
74117 }
74118
74119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
74120         LDKRawBolt11Invoice this_arg_conv;
74121         this_arg_conv.inner = untag_ptr(this_arg);
74122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74124         this_arg_conv.is_owned = false;
74125         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
74126         int64_t ret_ref = 0;
74127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74129         return ret_ref;
74130 }
74131
74132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74133         LDKRawBolt11Invoice this_arg_conv;
74134         this_arg_conv.inner = untag_ptr(this_arg);
74135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74137         this_arg_conv.is_owned = false;
74138         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
74139         int64_t ret_ref = 0;
74140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74142         return ret_ref;
74143 }
74144
74145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74146         LDKRawBolt11Invoice this_arg_conv;
74147         this_arg_conv.inner = untag_ptr(this_arg);
74148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74150         this_arg_conv.is_owned = false;
74151         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
74152         int64_t ret_ref = 0;
74153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74155         return ret_ref;
74156 }
74157
74158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
74159         LDKRawBolt11Invoice this_arg_conv;
74160         this_arg_conv.inner = untag_ptr(this_arg);
74161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74163         this_arg_conv.is_owned = false;
74164         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
74165         int64_t ret_ref = 0;
74166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74168         return ret_ref;
74169 }
74170
74171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
74172         LDKRawBolt11Invoice this_arg_conv;
74173         this_arg_conv.inner = untag_ptr(this_arg);
74174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74176         this_arg_conv.is_owned = false;
74177         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
74178         int64_t ret_ref = 0;
74179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74181         return ret_ref;
74182 }
74183
74184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
74185         LDKRawBolt11Invoice this_arg_conv;
74186         this_arg_conv.inner = untag_ptr(this_arg);
74187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74189         this_arg_conv.is_owned = false;
74190         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
74191         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
74192         int64_t ret_ref = tag_ptr(ret_copy, true);
74193         return ret_ref;
74194 }
74195
74196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
74197         LDKRawBolt11Invoice this_arg_conv;
74198         this_arg_conv.inner = untag_ptr(this_arg);
74199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74201         this_arg_conv.is_owned = false;
74202         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
74203         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
74204         int64_t ret_ref = tag_ptr(ret_copy, true);
74205         return ret_ref;
74206 }
74207
74208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
74209         LDKRawBolt11Invoice this_arg_conv;
74210         this_arg_conv.inner = untag_ptr(this_arg);
74211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74213         this_arg_conv.is_owned = false;
74214         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
74215         int64_t ret_ref = 0;
74216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74218         return ret_ref;
74219 }
74220
74221 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
74222         LDKRawBolt11Invoice this_arg_conv;
74223         this_arg_conv.inner = untag_ptr(this_arg);
74224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74226         this_arg_conv.is_owned = false;
74227         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
74228         int64_tArray ret_arr = NULL;
74229         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
74230         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
74231         for (size_t o = 0; o < ret_var.datalen; o++) {
74232                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
74233                 int64_t ret_conv_14_ref = 0;
74234                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
74235                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
74236                 ret_arr_ptr[o] = ret_conv_14_ref;
74237         }
74238         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
74239         FREE(ret_var.data);
74240         return ret_arr;
74241 }
74242
74243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
74244         LDKRawBolt11Invoice this_arg_conv;
74245         this_arg_conv.inner = untag_ptr(this_arg);
74246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74248         this_arg_conv.is_owned = false;
74249         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74250         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
74251         int64_t ret_ref = tag_ptr(ret_copy, true);
74252         return ret_ref;
74253 }
74254
74255 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
74256         LDKRawBolt11Invoice this_arg_conv;
74257         this_arg_conv.inner = untag_ptr(this_arg);
74258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74260         this_arg_conv.is_owned = false;
74261         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
74262         return ret_conv;
74263 }
74264
74265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
74266         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
74267         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
74268         return tag_ptr(ret_conv, true);
74269 }
74270
74271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
74272         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
74273         *ret_conv = PositiveTimestamp_from_system_time(time);
74274         return tag_ptr(ret_conv, true);
74275 }
74276
74277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
74278         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
74279         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
74280         return tag_ptr(ret_conv, true);
74281 }
74282
74283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
74284         LDKPositiveTimestamp this_arg_conv;
74285         this_arg_conv.inner = untag_ptr(this_arg);
74286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74288         this_arg_conv.is_owned = false;
74289         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
74290         return ret_conv;
74291 }
74292
74293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
74294         LDKPositiveTimestamp this_arg_conv;
74295         this_arg_conv.inner = untag_ptr(this_arg);
74296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74298         this_arg_conv.is_owned = false;
74299         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
74300         return ret_conv;
74301 }
74302
74303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
74304         LDKPositiveTimestamp this_arg_conv;
74305         this_arg_conv.inner = untag_ptr(this_arg);
74306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74308         this_arg_conv.is_owned = false;
74309         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
74310         return ret_conv;
74311 }
74312
74313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74314         LDKBolt11Invoice this_arg_conv;
74315         this_arg_conv.inner = untag_ptr(this_arg);
74316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74318         this_arg_conv.is_owned = false;
74319         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74320         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
74321         return ret_arr;
74322 }
74323
74324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
74325         LDKBolt11Invoice this_arg_conv;
74326         this_arg_conv.inner = untag_ptr(this_arg);
74327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74329         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
74330         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
74331         int64_t ret_ref = 0;
74332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74334         return ret_ref;
74335 }
74336
74337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74338         LDKBolt11Invoice this_arg_conv;
74339         this_arg_conv.inner = untag_ptr(this_arg);
74340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74342         this_arg_conv.is_owned = false;
74343         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
74344         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
74345         return tag_ptr(ret_conv, true);
74346 }
74347
74348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
74349         LDKSignedRawBolt11Invoice signed_invoice_conv;
74350         signed_invoice_conv.inner = untag_ptr(signed_invoice);
74351         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
74352         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
74353         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
74354         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
74355         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
74356         return tag_ptr(ret_conv, true);
74357 }
74358
74359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
74360         LDKBolt11Invoice this_arg_conv;
74361         this_arg_conv.inner = untag_ptr(this_arg);
74362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74364         this_arg_conv.is_owned = false;
74365         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
74366         return ret_conv;
74367 }
74368
74369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
74370         LDKBolt11Invoice this_arg_conv;
74371         this_arg_conv.inner = untag_ptr(this_arg);
74372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74374         this_arg_conv.is_owned = false;
74375         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
74376         return ret_conv;
74377 }
74378
74379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74380         LDKBolt11Invoice this_arg_conv;
74381         this_arg_conv.inner = untag_ptr(this_arg);
74382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74384         this_arg_conv.is_owned = false;
74385         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74386         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
74387         return ret_arr;
74388 }
74389
74390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74391         LDKBolt11Invoice this_arg_conv;
74392         this_arg_conv.inner = untag_ptr(this_arg);
74393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74395         this_arg_conv.is_owned = false;
74396         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
74397         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
74398         return ret_arr;
74399 }
74400
74401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
74402         LDKBolt11Invoice this_arg_conv;
74403         this_arg_conv.inner = untag_ptr(this_arg);
74404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74406         this_arg_conv.is_owned = false;
74407         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74408         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
74409         return ret_arr;
74410 }
74411
74412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
74413         LDKBolt11Invoice this_arg_conv;
74414         this_arg_conv.inner = untag_ptr(this_arg);
74415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74417         this_arg_conv.is_owned = false;
74418         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
74419         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
74420         int64_t ret_ref = tag_ptr(ret_copy, true);
74421         return ret_ref;
74422 }
74423
74424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
74425         LDKBolt11Invoice this_arg_conv;
74426         this_arg_conv.inner = untag_ptr(this_arg);
74427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74429         this_arg_conv.is_owned = false;
74430         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
74431         int64_t ret_ref = 0;
74432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74434         return ret_ref;
74435 }
74436
74437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74438         LDKBolt11Invoice this_arg_conv;
74439         this_arg_conv.inner = untag_ptr(this_arg);
74440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74442         this_arg_conv.is_owned = false;
74443         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
74444         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
74445         return ret_arr;
74446 }
74447
74448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
74449         LDKBolt11Invoice this_arg_conv;
74450         this_arg_conv.inner = untag_ptr(this_arg);
74451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74453         this_arg_conv.is_owned = false;
74454         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74455         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
74456         int64_t ret_ref = tag_ptr(ret_copy, true);
74457         return ret_ref;
74458 }
74459
74460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
74461         LDKBolt11Invoice this_arg_conv;
74462         this_arg_conv.inner = untag_ptr(this_arg);
74463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74465         this_arg_conv.is_owned = false;
74466         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
74467         return ret_conv;
74468 }
74469
74470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
74471         LDKBolt11Invoice this_arg_conv;
74472         this_arg_conv.inner = untag_ptr(this_arg);
74473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74475         this_arg_conv.is_owned = false;
74476         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
74477         return ret_conv;
74478 }
74479
74480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
74481         LDKBolt11Invoice this_arg_conv;
74482         this_arg_conv.inner = untag_ptr(this_arg);
74483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74485         this_arg_conv.is_owned = false;
74486         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
74487         return ret_conv;
74488 }
74489
74490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiration_1remaining_1from_1epoch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t time) {
74491         LDKBolt11Invoice this_arg_conv;
74492         this_arg_conv.inner = untag_ptr(this_arg);
74493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74495         this_arg_conv.is_owned = false;
74496         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
74497         return ret_conv;
74498 }
74499
74500 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
74501         LDKBolt11Invoice this_arg_conv;
74502         this_arg_conv.inner = untag_ptr(this_arg);
74503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74505         this_arg_conv.is_owned = false;
74506         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
74507         return ret_conv;
74508 }
74509
74510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
74511         LDKBolt11Invoice this_arg_conv;
74512         this_arg_conv.inner = untag_ptr(this_arg);
74513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74515         this_arg_conv.is_owned = false;
74516         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
74517         return ret_conv;
74518 }
74519
74520 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
74521         LDKBolt11Invoice this_arg_conv;
74522         this_arg_conv.inner = untag_ptr(this_arg);
74523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74525         this_arg_conv.is_owned = false;
74526         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
74527         jobjectArray ret_arr = NULL;
74528         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
74529         ;
74530         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
74531         for (size_t i = 0; i < ret_var.datalen; i++) {
74532                 LDKStr ret_conv_8_str = ret_var.data[i];
74533                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
74534                 Str_free(ret_conv_8_str);
74535                 ret_arr_ptr[i] = ret_conv_8_conv;
74536         }
74537         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
74538         FREE(ret_var.data);
74539         return ret_arr;
74540 }
74541
74542 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
74543         LDKBolt11Invoice this_arg_conv;
74544         this_arg_conv.inner = untag_ptr(this_arg);
74545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74547         this_arg_conv.is_owned = false;
74548         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
74549         int64_tArray ret_arr = NULL;
74550         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
74551         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
74552         for (size_t o = 0; o < ret_var.datalen; o++) {
74553                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
74554                 int64_t ret_conv_14_ref = 0;
74555                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
74556                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
74557                 ret_arr_ptr[o] = ret_conv_14_ref;
74558         }
74559         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
74560         FREE(ret_var.data);
74561         return ret_arr;
74562 }
74563
74564 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
74565         LDKBolt11Invoice this_arg_conv;
74566         this_arg_conv.inner = untag_ptr(this_arg);
74567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74569         this_arg_conv.is_owned = false;
74570         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
74571         int64_tArray ret_arr = NULL;
74572         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
74573         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
74574         for (size_t l = 0; l < ret_var.datalen; l++) {
74575                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
74576                 int64_t ret_conv_11_ref = 0;
74577                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
74578                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
74579                 ret_arr_ptr[l] = ret_conv_11_ref;
74580         }
74581         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
74582         FREE(ret_var.data);
74583         return ret_arr;
74584 }
74585
74586 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
74587         LDKBolt11Invoice this_arg_conv;
74588         this_arg_conv.inner = untag_ptr(this_arg);
74589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74591         this_arg_conv.is_owned = false;
74592         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
74593         return ret_conv;
74594 }
74595
74596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
74597         LDKBolt11Invoice this_arg_conv;
74598         this_arg_conv.inner = untag_ptr(this_arg);
74599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74601         this_arg_conv.is_owned = false;
74602         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74603         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
74604         int64_t ret_ref = tag_ptr(ret_copy, true);
74605         return ret_ref;
74606 }
74607
74608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
74609         LDKStr description_conv = java_to_owned_str(env, description);
74610         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
74611         *ret_conv = Description_new(description_conv);
74612         return tag_ptr(ret_conv, true);
74613 }
74614
74615 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
74616         LDKDescription this_arg_conv;
74617         this_arg_conv.inner = untag_ptr(this_arg);
74618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74620         this_arg_conv = Description_clone(&this_arg_conv);
74621         LDKStr ret_str = Description_into_inner(this_arg_conv);
74622         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74623         Str_free(ret_str);
74624         return ret_conv;
74625 }
74626
74627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
74628         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
74629         int64_t ret_ref = 0;
74630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74632         return ret_ref;
74633 }
74634
74635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
74636         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
74637         int64_t ret_ref = 0;
74638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74640         return ret_ref;
74641 }
74642
74643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
74644         LDKExpiryTime this_arg_conv;
74645         this_arg_conv.inner = untag_ptr(this_arg);
74646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74648         this_arg_conv.is_owned = false;
74649         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
74650         return ret_conv;
74651 }
74652
74653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
74654         LDKExpiryTime this_arg_conv;
74655         this_arg_conv.inner = untag_ptr(this_arg);
74656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74658         this_arg_conv.is_owned = false;
74659         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
74660         return ret_conv;
74661 }
74662
74663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
74664         LDKRouteHint hops_conv;
74665         hops_conv.inner = untag_ptr(hops);
74666         hops_conv.is_owned = ptr_is_owned(hops);
74667         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
74668         hops_conv = RouteHint_clone(&hops_conv);
74669         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
74670         *ret_conv = PrivateRoute_new(hops_conv);
74671         return tag_ptr(ret_conv, true);
74672 }
74673
74674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
74675         LDKPrivateRoute this_arg_conv;
74676         this_arg_conv.inner = untag_ptr(this_arg);
74677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74679         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
74680         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
74681         int64_t ret_ref = 0;
74682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74684         return ret_ref;
74685 }
74686
74687 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74688         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
74689         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
74690         return ret_conv;
74691 }
74692
74693 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
74694         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
74695         return ret_conv;
74696 }
74697
74698 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
74699         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
74700         return ret_conv;
74701 }
74702
74703 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
74704         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
74705         return ret_conv;
74706 }
74707
74708 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
74709         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
74710         return ret_conv;
74711 }
74712
74713 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
74714         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
74715         return ret_conv;
74716 }
74717
74718 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
74719         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
74720         return ret_conv;
74721 }
74722
74723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74724         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
74725         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
74726         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
74727         return ret_conv;
74728 }
74729
74730 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
74731         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
74732         LDKStr ret_str = CreationError_to_str(o_conv);
74733         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74734         Str_free(ret_str);
74735         return ret_conv;
74736 }
74737
74738 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74739         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
74740         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
74741         return ret_conv;
74742 }
74743
74744 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
74745         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
74746         return ret_conv;
74747 }
74748
74749 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
74750         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
74751         return ret_conv;
74752 }
74753
74754 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
74755         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
74756         return ret_conv;
74757 }
74758
74759 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
74760         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
74761         return ret_conv;
74762 }
74763
74764 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
74765         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
74766         return ret_conv;
74767 }
74768
74769 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
74770         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
74771         return ret_conv;
74772 }
74773
74774 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
74775         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
74776         return ret_conv;
74777 }
74778
74779 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
74780         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
74781         return ret_conv;
74782 }
74783
74784 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
74785         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
74786         return ret_conv;
74787 }
74788
74789 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
74790         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
74791         return ret_conv;
74792 }
74793
74794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74795         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
74796         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
74797         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
74798         return ret_conv;
74799 }
74800
74801 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
74802         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
74803         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
74804         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74805         Str_free(ret_str);
74806         return ret_conv;
74807 }
74808
74809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74810         if (!ptr_is_owned(this_ptr)) return;
74811         void* this_ptr_ptr = untag_ptr(this_ptr);
74812         CHECK_ACCESS(this_ptr_ptr);
74813         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
74814         FREE(untag_ptr(this_ptr));
74815         SignOrCreationError_free(this_ptr_conv);
74816 }
74817
74818 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
74819         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
74820         *ret_copy = SignOrCreationError_clone(arg);
74821         int64_t ret_ref = tag_ptr(ret_copy, true);
74822         return ret_ref;
74823 }
74824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74825         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
74826         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
74827         return ret_conv;
74828 }
74829
74830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74831         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
74832         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
74833         *ret_copy = SignOrCreationError_clone(orig_conv);
74834         int64_t ret_ref = tag_ptr(ret_copy, true);
74835         return ret_ref;
74836 }
74837
74838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
74839         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
74840         *ret_copy = SignOrCreationError_sign_error();
74841         int64_t ret_ref = tag_ptr(ret_copy, true);
74842         return ret_ref;
74843 }
74844
74845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
74846         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
74847         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
74848         *ret_copy = SignOrCreationError_creation_error(a_conv);
74849         int64_t ret_ref = tag_ptr(ret_copy, true);
74850         return ret_ref;
74851 }
74852
74853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74854         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
74855         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
74856         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
74857         return ret_conv;
74858 }
74859
74860 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
74861         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
74862         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
74863         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74864         Str_free(ret_str);
74865         return ret_conv;
74866 }
74867
74868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t retry_strategy, int64_t channelmanager) {
74869         LDKBolt11Invoice invoice_conv;
74870         invoice_conv.inner = untag_ptr(invoice);
74871         invoice_conv.is_owned = ptr_is_owned(invoice);
74872         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74873         invoice_conv.is_owned = false;
74874         void* retry_strategy_ptr = untag_ptr(retry_strategy);
74875         CHECK_ACCESS(retry_strategy_ptr);
74876         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
74877         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
74878         LDKChannelManager channelmanager_conv;
74879         channelmanager_conv.inner = untag_ptr(channelmanager);
74880         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74881         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74882         channelmanager_conv.is_owned = false;
74883         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
74884         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
74885         return tag_ptr(ret_conv, true);
74886 }
74887
74888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) {
74889         LDKBolt11Invoice invoice_conv;
74890         invoice_conv.inner = untag_ptr(invoice);
74891         invoice_conv.is_owned = ptr_is_owned(invoice);
74892         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74893         invoice_conv.is_owned = false;
74894         LDKThirtyTwoBytes payment_id_ref;
74895         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
74896         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
74897         void* retry_strategy_ptr = untag_ptr(retry_strategy);
74898         CHECK_ACCESS(retry_strategy_ptr);
74899         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
74900         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
74901         LDKChannelManager channelmanager_conv;
74902         channelmanager_conv.inner = untag_ptr(channelmanager);
74903         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74904         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74905         channelmanager_conv.is_owned = false;
74906         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
74907         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
74908         return tag_ptr(ret_conv, true);
74909 }
74910
74911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int64_t retry_strategy, int64_t channelmanager) {
74912         LDKBolt11Invoice invoice_conv;
74913         invoice_conv.inner = untag_ptr(invoice);
74914         invoice_conv.is_owned = ptr_is_owned(invoice);
74915         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74916         invoice_conv.is_owned = false;
74917         void* retry_strategy_ptr = untag_ptr(retry_strategy);
74918         CHECK_ACCESS(retry_strategy_ptr);
74919         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
74920         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
74921         LDKChannelManager channelmanager_conv;
74922         channelmanager_conv.inner = untag_ptr(channelmanager);
74923         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74924         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74925         channelmanager_conv.is_owned = false;
74926         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
74927         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
74928         return tag_ptr(ret_conv, true);
74929 }
74930
74931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) {
74932         LDKBolt11Invoice invoice_conv;
74933         invoice_conv.inner = untag_ptr(invoice);
74934         invoice_conv.is_owned = ptr_is_owned(invoice);
74935         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74936         invoice_conv.is_owned = false;
74937         LDKThirtyTwoBytes payment_id_ref;
74938         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
74939         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
74940         void* retry_strategy_ptr = untag_ptr(retry_strategy);
74941         CHECK_ACCESS(retry_strategy_ptr);
74942         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
74943         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
74944         LDKChannelManager channelmanager_conv;
74945         channelmanager_conv.inner = untag_ptr(channelmanager);
74946         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74947         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74948         channelmanager_conv.is_owned = false;
74949         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
74950         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
74951         return tag_ptr(ret_conv, true);
74952 }
74953
74954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_preflight_1probe_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t channelmanager, int64_t liquidity_limit_multiplier) {
74955         LDKBolt11Invoice invoice_conv;
74956         invoice_conv.inner = untag_ptr(invoice);
74957         invoice_conv.is_owned = ptr_is_owned(invoice);
74958         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74959         invoice_conv.is_owned = false;
74960         LDKChannelManager channelmanager_conv;
74961         channelmanager_conv.inner = untag_ptr(channelmanager);
74962         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74963         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74964         channelmanager_conv.is_owned = false;
74965         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
74966         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
74967         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
74968         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
74969         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
74970         *ret_conv = preflight_probe_invoice(&invoice_conv, &channelmanager_conv, liquidity_limit_multiplier_conv);
74971         return tag_ptr(ret_conv, true);
74972 }
74973
74974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_preflight_1probe_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msat, int64_t channelmanager, int64_t liquidity_limit_multiplier) {
74975         LDKBolt11Invoice invoice_conv;
74976         invoice_conv.inner = untag_ptr(invoice);
74977         invoice_conv.is_owned = ptr_is_owned(invoice);
74978         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
74979         invoice_conv.is_owned = false;
74980         LDKChannelManager channelmanager_conv;
74981         channelmanager_conv.inner = untag_ptr(channelmanager);
74982         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
74983         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
74984         channelmanager_conv.is_owned = false;
74985         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
74986         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
74987         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
74988         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
74989         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
74990         *ret_conv = preflight_probe_zero_value_invoice(&invoice_conv, amount_msat, &channelmanager_conv, liquidity_limit_multiplier_conv);
74991         return tag_ptr(ret_conv, true);
74992 }
74993
74994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74995         if (!ptr_is_owned(this_ptr)) return;
74996         void* this_ptr_ptr = untag_ptr(this_ptr);
74997         CHECK_ACCESS(this_ptr_ptr);
74998         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
74999         FREE(untag_ptr(this_ptr));
75000         PaymentError_free(this_ptr_conv);
75001 }
75002
75003 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
75004         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75005         *ret_copy = PaymentError_clone(arg);
75006         int64_t ret_ref = tag_ptr(ret_copy, true);
75007         return ret_ref;
75008 }
75009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75010         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
75011         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
75012         return ret_conv;
75013 }
75014
75015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75016         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
75017         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75018         *ret_copy = PaymentError_clone(orig_conv);
75019         int64_t ret_ref = tag_ptr(ret_copy, true);
75020         return ret_ref;
75021 }
75022
75023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
75024         LDKStr a_conv = java_to_owned_str(env, a);
75025         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75026         *ret_copy = PaymentError_invoice(a_conv);
75027         int64_t ret_ref = tag_ptr(ret_copy, true);
75028         return ret_ref;
75029 }
75030
75031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, jclass a) {
75032         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_java(env, a);
75033         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75034         *ret_copy = PaymentError_sending(a_conv);
75035         int64_t ret_ref = tag_ptr(ret_copy, true);
75036         return ret_ref;
75037 }
75038
75039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75040         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
75041         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
75042         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
75043         return ret_conv;
75044 }
75045
75046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbingError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75047         if (!ptr_is_owned(this_ptr)) return;
75048         void* this_ptr_ptr = untag_ptr(this_ptr);
75049         CHECK_ACCESS(this_ptr_ptr);
75050         LDKProbingError this_ptr_conv = *(LDKProbingError*)(this_ptr_ptr);
75051         FREE(untag_ptr(this_ptr));
75052         ProbingError_free(this_ptr_conv);
75053 }
75054
75055 static inline uint64_t ProbingError_clone_ptr(LDKProbingError *NONNULL_PTR arg) {
75056         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75057         *ret_copy = ProbingError_clone(arg);
75058         int64_t ret_ref = tag_ptr(ret_copy, true);
75059         return ret_ref;
75060 }
75061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75062         LDKProbingError* arg_conv = (LDKProbingError*)untag_ptr(arg);
75063         int64_t ret_conv = ProbingError_clone_ptr(arg_conv);
75064         return ret_conv;
75065 }
75066
75067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75068         LDKProbingError* orig_conv = (LDKProbingError*)untag_ptr(orig);
75069         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75070         *ret_copy = ProbingError_clone(orig_conv);
75071         int64_t ret_ref = tag_ptr(ret_copy, true);
75072         return ret_ref;
75073 }
75074
75075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1invoice(JNIEnv *env, jclass clz, jstring a) {
75076         LDKStr a_conv = java_to_owned_str(env, a);
75077         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75078         *ret_copy = ProbingError_invoice(a_conv);
75079         int64_t ret_ref = tag_ptr(ret_copy, true);
75080         return ret_ref;
75081 }
75082
75083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1sending(JNIEnv *env, jclass clz, int64_t a) {
75084         void* a_ptr = untag_ptr(a);
75085         CHECK_ACCESS(a_ptr);
75086         LDKProbeSendFailure a_conv = *(LDKProbeSendFailure*)(a_ptr);
75087         a_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(a));
75088         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75089         *ret_copy = ProbingError_sending(a_conv);
75090         int64_t ret_ref = tag_ptr(ret_copy, true);
75091         return ret_ref;
75092 }
75093
75094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbingError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75095         LDKProbingError* a_conv = (LDKProbingError*)untag_ptr(a);
75096         LDKProbingError* b_conv = (LDKProbingError*)untag_ptr(b);
75097         jboolean ret_conv = ProbingError_eq(a_conv, b_conv);
75098         return ret_conv;
75099 }
75100
75101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
75102         void* amt_msat_ptr = untag_ptr(amt_msat);
75103         CHECK_ACCESS(amt_msat_ptr);
75104         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75105         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75106         void* payment_hash_ptr = untag_ptr(payment_hash);
75107         CHECK_ACCESS(payment_hash_ptr);
75108         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
75109         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
75110         LDKStr description_conv = java_to_owned_str(env, description);
75111         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
75112         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
75113         if (phantom_route_hints_constr.datalen > 0)
75114                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
75115         else
75116                 phantom_route_hints_constr.data = NULL;
75117         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
75118         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
75119                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
75120                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
75121                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
75122                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
75123                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
75124                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
75125                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
75126         }
75127         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
75128         void* entropy_source_ptr = untag_ptr(entropy_source);
75129         CHECK_ACCESS(entropy_source_ptr);
75130         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75131         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75132                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75133                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75134         }
75135         void* node_signer_ptr = untag_ptr(node_signer);
75136         CHECK_ACCESS(node_signer_ptr);
75137         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75138         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75139                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75140                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75141         }
75142         void* logger_ptr = untag_ptr(logger);
75143         CHECK_ACCESS(logger_ptr);
75144         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75145         if (logger_conv.free == LDKLogger_JCalls_free) {
75146                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75147                 LDKLogger_JCalls_cloned(&logger_conv);
75148         }
75149         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75150         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75151         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75152         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75153         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75154         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75155         *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_conv, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
75156         return tag_ptr(ret_conv, true);
75157 }
75158
75159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
75160         void* amt_msat_ptr = untag_ptr(amt_msat);
75161         CHECK_ACCESS(amt_msat_ptr);
75162         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75163         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75164         void* payment_hash_ptr = untag_ptr(payment_hash);
75165         CHECK_ACCESS(payment_hash_ptr);
75166         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
75167         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
75168         LDKSha256 description_hash_conv;
75169         description_hash_conv.inner = untag_ptr(description_hash);
75170         description_hash_conv.is_owned = ptr_is_owned(description_hash);
75171         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
75172         description_hash_conv = Sha256_clone(&description_hash_conv);
75173         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
75174         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
75175         if (phantom_route_hints_constr.datalen > 0)
75176                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
75177         else
75178                 phantom_route_hints_constr.data = NULL;
75179         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
75180         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
75181                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
75182                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
75183                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
75184                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
75185                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
75186                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
75187                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
75188         }
75189         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
75190         void* entropy_source_ptr = untag_ptr(entropy_source);
75191         CHECK_ACCESS(entropy_source_ptr);
75192         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75193         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75194                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75195                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75196         }
75197         void* node_signer_ptr = untag_ptr(node_signer);
75198         CHECK_ACCESS(node_signer_ptr);
75199         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75200         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75201                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75202                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75203         }
75204         void* logger_ptr = untag_ptr(logger);
75205         CHECK_ACCESS(logger_ptr);
75206         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75207         if (logger_conv.free == LDKLogger_JCalls_free) {
75208                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75209                 LDKLogger_JCalls_cloned(&logger_conv);
75210         }
75211         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75212         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75213         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75214         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75215         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75216         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75217         *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_conv, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
75218         return tag_ptr(ret_conv, true);
75219 }
75220
75221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
75222         LDKChannelManager channelmanager_conv;
75223         channelmanager_conv.inner = untag_ptr(channelmanager);
75224         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75225         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75226         channelmanager_conv.is_owned = false;
75227         void* node_signer_ptr = untag_ptr(node_signer);
75228         CHECK_ACCESS(node_signer_ptr);
75229         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75230         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75231                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75232                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75233         }
75234         void* logger_ptr = untag_ptr(logger);
75235         CHECK_ACCESS(logger_ptr);
75236         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75237         if (logger_conv.free == LDKLogger_JCalls_free) {
75238                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75239                 LDKLogger_JCalls_cloned(&logger_conv);
75240         }
75241         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75242         void* amt_msat_ptr = untag_ptr(amt_msat);
75243         CHECK_ACCESS(amt_msat_ptr);
75244         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75245         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75246         LDKStr description_conv = java_to_owned_str(env, description);
75247         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75248         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75249         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75250         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75251         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75252         *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
75253         return tag_ptr(ret_conv, true);
75254 }
75255
75256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
75257         LDKChannelManager channelmanager_conv;
75258         channelmanager_conv.inner = untag_ptr(channelmanager);
75259         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75260         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75261         channelmanager_conv.is_owned = false;
75262         void* node_signer_ptr = untag_ptr(node_signer);
75263         CHECK_ACCESS(node_signer_ptr);
75264         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75265         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75266                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75267                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75268         }
75269         void* logger_ptr = untag_ptr(logger);
75270         CHECK_ACCESS(logger_ptr);
75271         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75272         if (logger_conv.free == LDKLogger_JCalls_free) {
75273                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75274                 LDKLogger_JCalls_cloned(&logger_conv);
75275         }
75276         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75277         void* amt_msat_ptr = untag_ptr(amt_msat);
75278         CHECK_ACCESS(amt_msat_ptr);
75279         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75280         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75281         LDKSha256 description_hash_conv;
75282         description_hash_conv.inner = untag_ptr(description_hash);
75283         description_hash_conv.is_owned = ptr_is_owned(description_hash);
75284         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
75285         description_hash_conv = Sha256_clone(&description_hash_conv);
75286         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75287         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75288         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75289         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75290         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75291         *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
75292         return tag_ptr(ret_conv, true);
75293 }
75294
75295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
75296         LDKChannelManager channelmanager_conv;
75297         channelmanager_conv.inner = untag_ptr(channelmanager);
75298         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75299         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75300         channelmanager_conv.is_owned = false;
75301         void* node_signer_ptr = untag_ptr(node_signer);
75302         CHECK_ACCESS(node_signer_ptr);
75303         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75304         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75305                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75306                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75307         }
75308         void* logger_ptr = untag_ptr(logger);
75309         CHECK_ACCESS(logger_ptr);
75310         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75311         if (logger_conv.free == LDKLogger_JCalls_free) {
75312                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75313                 LDKLogger_JCalls_cloned(&logger_conv);
75314         }
75315         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75316         void* amt_msat_ptr = untag_ptr(amt_msat);
75317         CHECK_ACCESS(amt_msat_ptr);
75318         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75319         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75320         LDKSha256 description_hash_conv;
75321         description_hash_conv.inner = untag_ptr(description_hash);
75322         description_hash_conv.is_owned = ptr_is_owned(description_hash);
75323         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
75324         description_hash_conv = Sha256_clone(&description_hash_conv);
75325         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75326         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75327         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75328         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75329         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75330         *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
75331         return tag_ptr(ret_conv, true);
75332 }
75333
75334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
75335         LDKChannelManager channelmanager_conv;
75336         channelmanager_conv.inner = untag_ptr(channelmanager);
75337         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75338         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75339         channelmanager_conv.is_owned = false;
75340         void* node_signer_ptr = untag_ptr(node_signer);
75341         CHECK_ACCESS(node_signer_ptr);
75342         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75343         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75344                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75345                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75346         }
75347         void* logger_ptr = untag_ptr(logger);
75348         CHECK_ACCESS(logger_ptr);
75349         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75350         if (logger_conv.free == LDKLogger_JCalls_free) {
75351                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75352                 LDKLogger_JCalls_cloned(&logger_conv);
75353         }
75354         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75355         void* amt_msat_ptr = untag_ptr(amt_msat);
75356         CHECK_ACCESS(amt_msat_ptr);
75357         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75358         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75359         LDKStr description_conv = java_to_owned_str(env, description);
75360         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75361         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75362         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75363         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75364         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75365         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
75366         return tag_ptr(ret_conv, true);
75367 }
75368
75369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch_1with_1payment_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int8_tArray payment_hash, int64_t min_final_cltv_expiry_delta) {
75370         LDKChannelManager channelmanager_conv;
75371         channelmanager_conv.inner = untag_ptr(channelmanager);
75372         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75373         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75374         channelmanager_conv.is_owned = false;
75375         void* node_signer_ptr = untag_ptr(node_signer);
75376         CHECK_ACCESS(node_signer_ptr);
75377         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75378         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75379                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75380                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75381         }
75382         void* logger_ptr = untag_ptr(logger);
75383         CHECK_ACCESS(logger_ptr);
75384         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75385         if (logger_conv.free == LDKLogger_JCalls_free) {
75386                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75387                 LDKLogger_JCalls_cloned(&logger_conv);
75388         }
75389         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75390         void* amt_msat_ptr = untag_ptr(amt_msat);
75391         CHECK_ACCESS(amt_msat_ptr);
75392         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75393         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75394         LDKStr description_conv = java_to_owned_str(env, description);
75395         LDKThirtyTwoBytes payment_hash_ref;
75396         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
75397         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
75398         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75399         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75400         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75401         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75402         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75403         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref, min_final_cltv_expiry_delta_conv);
75404         return tag_ptr(ret_conv, true);
75405 }
75406
75407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
75408         LDKStr s_conv = java_to_owned_str(env, s);
75409         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
75410         *ret_conv = SiPrefix_from_str(s_conv);
75411         return tag_ptr(ret_conv, true);
75412 }
75413
75414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
75415         LDKStr s_conv = java_to_owned_str(env, s);
75416         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
75417         *ret_conv = Bolt11Invoice_from_str(s_conv);
75418         return tag_ptr(ret_conv, true);
75419 }
75420
75421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
75422         LDKStr s_conv = java_to_owned_str(env, s);
75423         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
75424         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
75425         return tag_ptr(ret_conv, true);
75426 }
75427
75428 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75429         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
75430         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
75431         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75432         Str_free(ret_str);
75433         return ret_conv;
75434 }
75435
75436 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75437         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
75438         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
75439         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75440         Str_free(ret_str);
75441         return ret_conv;
75442 }
75443
75444 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75445         LDKBolt11Invoice o_conv;
75446         o_conv.inner = untag_ptr(o);
75447         o_conv.is_owned = ptr_is_owned(o);
75448         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75449         o_conv.is_owned = false;
75450         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
75451         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75452         Str_free(ret_str);
75453         return ret_conv;
75454 }
75455
75456 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75457         LDKSignedRawBolt11Invoice o_conv;
75458         o_conv.inner = untag_ptr(o);
75459         o_conv.is_owned = ptr_is_owned(o);
75460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75461         o_conv.is_owned = false;
75462         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
75463         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75464         Str_free(ret_str);
75465         return ret_conv;
75466 }
75467
75468 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75469         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
75470         LDKStr ret_str = Currency_to_str(o_conv);
75471         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75472         Str_free(ret_str);
75473         return ret_conv;
75474 }
75475
75476 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75477         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
75478         LDKStr ret_str = SiPrefix_to_str(o_conv);
75479         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75480         Str_free(ret_str);
75481         return ret_conv;
75482 }
75483
75484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75485         LDKRapidGossipSync this_obj_conv;
75486         this_obj_conv.inner = untag_ptr(this_obj);
75487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75489         RapidGossipSync_free(this_obj_conv);
75490 }
75491
75492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
75493         LDKNetworkGraph network_graph_conv;
75494         network_graph_conv.inner = untag_ptr(network_graph);
75495         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75496         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75497         network_graph_conv.is_owned = false;
75498         void* logger_ptr = untag_ptr(logger);
75499         CHECK_ACCESS(logger_ptr);
75500         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75501         if (logger_conv.free == LDKLogger_JCalls_free) {
75502                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75503                 LDKLogger_JCalls_cloned(&logger_conv);
75504         }
75505         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
75506         int64_t ret_ref = 0;
75507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75509         return ret_ref;
75510 }
75511
75512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1sync_1network_1graph_1with_1file_1path(JNIEnv *env, jclass clz, int64_t this_arg, jstring sync_path) {
75513         LDKRapidGossipSync this_arg_conv;
75514         this_arg_conv.inner = untag_ptr(this_arg);
75515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75517         this_arg_conv.is_owned = false;
75518         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
75519         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
75520         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
75521         return tag_ptr(ret_conv, true);
75522 }
75523
75524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data) {
75525         LDKRapidGossipSync this_arg_conv;
75526         this_arg_conv.inner = untag_ptr(this_arg);
75527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75529         this_arg_conv.is_owned = false;
75530         LDKu8slice update_data_ref;
75531         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
75532         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
75533         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
75534         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
75535         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
75536         return tag_ptr(ret_conv, true);
75537 }
75538
75539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data, int64_t current_time_unix) {
75540         LDKRapidGossipSync this_arg_conv;
75541         this_arg_conv.inner = untag_ptr(this_arg);
75542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75544         this_arg_conv.is_owned = false;
75545         LDKu8slice update_data_ref;
75546         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
75547         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
75548         void* current_time_unix_ptr = untag_ptr(current_time_unix);
75549         CHECK_ACCESS(current_time_unix_ptr);
75550         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
75551         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
75552         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
75553         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
75554         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
75555         return tag_ptr(ret_conv, true);
75556 }
75557
75558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
75559         LDKRapidGossipSync this_arg_conv;
75560         this_arg_conv.inner = untag_ptr(this_arg);
75561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75563         this_arg_conv.is_owned = false;
75564         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
75565         return ret_conv;
75566 }
75567
75568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75569         if (!ptr_is_owned(this_ptr)) return;
75570         void* this_ptr_ptr = untag_ptr(this_ptr);
75571         CHECK_ACCESS(this_ptr_ptr);
75572         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
75573         FREE(untag_ptr(this_ptr));
75574         GraphSyncError_free(this_ptr_conv);
75575 }
75576
75577 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
75578         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
75579         *ret_copy = GraphSyncError_clone(arg);
75580         int64_t ret_ref = tag_ptr(ret_copy, true);
75581         return ret_ref;
75582 }
75583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75584         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
75585         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
75586         return ret_conv;
75587 }
75588
75589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75590         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
75591         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
75592         *ret_copy = GraphSyncError_clone(orig_conv);
75593         int64_t ret_ref = tag_ptr(ret_copy, true);
75594         return ret_ref;
75595 }
75596
75597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
75598         void* a_ptr = untag_ptr(a);
75599         CHECK_ACCESS(a_ptr);
75600         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
75601         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
75602         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
75603         *ret_copy = GraphSyncError_decode_error(a_conv);
75604         int64_t ret_ref = tag_ptr(ret_copy, true);
75605         return ret_ref;
75606 }
75607
75608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
75609         LDKLightningError a_conv;
75610         a_conv.inner = untag_ptr(a);
75611         a_conv.is_owned = ptr_is_owned(a);
75612         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75613         a_conv = LightningError_clone(&a_conv);
75614         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
75615         *ret_copy = GraphSyncError_lightning_error(a_conv);
75616         int64_t ret_ref = tag_ptr(ret_copy, true);
75617         return ret_ref;
75618 }
75619